I have a zip file which I want to deploy to a Nexus repository. So I created a pom.xml file and a settings.xml file to do this. I was able to successfully upload to nexus but it seems it was deployed as a jar file
When I put in <packaging>zip</packaging>
element, maven doesn't recognize it. How can I accomplish my goal of deploying my zip file to nexus? Any help will be greatly appreciated.
Contents of directory: 1. content.zip 2. pom file 3. settings file
pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.ct.ty16.archive</groupId>
<artifactId>contentzip</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Deploy-zip-file</name>
<description>Deploy zipped content file on Jenkins to Nexus</description>
...
...
...
</project>
Note: I am not using maven to build the content.zip file, just upload it
Define your server in the settings.xml
<servers>
...
<server>
<id>server-snapshots</id>
<username>server-snapshots-username</username>
<password>server-snapshots-password</password>
</server>
...
</servers>
Define deploy-file configuration for deploy
phase
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
<repositoryId>${project.distributionManagement.snapshotRepository.id}</repositoryId>
<url>${project.distributionManagement.snapshotRepository.url}</url>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>zip</packaging>
</configuration>
</execution>
</executions>
</plugin>
Define the snapshotRepository
<distributionManagement>
<snapshotRepository>
<id>server-snapshots</id>
<name>Snapshots repository (snapshots)</name>
<url>http://repository.com/repo/server-snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</snapshotRepository>
</distributionManagement>
Execute mvn deploy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With