This is problem I am trying to solve:
- checkout code from Github to a local directory D
- run configure command inside directory D
- create a tar.gz for directory
- upload taz.gz file to Nexus
I am stuck at step 3: - I can specify the version in Maven pom.xml file, but is there a way to automatically create a build version every time Jenkins is run? - If I specify tar.gz in pom.xml file, I would get: Unknown packaging: gz @ line 6, column 13
If I specify jar inside packaging, there is no error, and files are upload to Nexus successfully.
Any advice would help, thanks!
==
follow suggestion, I am using Assembly Plugin, but still having trouble create tar.gz for Directory RE
Here is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.o$
<modelVersion>4.0.0</modelVersion>
<groupId>Auc</groupId>
<artifactId>RE</artifactId>
<version>1.0.0.112</version>
<!-- <packaging>tgz</packaging> -->
<name>RE Repository</name>
<url>http://nexus1.ccorp.com/nexus</url>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<configuration>
<descriptors>
<descriptor>format.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Here is my format.xml file, RE directory is where I checked out the code and want to create tar.gz for it
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bundle</id>
<formats>
<format>tar.gz</format>
</formats>
<moduleSets>
<moduleSet>
<sources>
<fileSets>
<fileSet>
<directory>/var/lib/jenkins/jobs/nightly_build/workspace/RE</directory>
</fileSet>
</fileSets>
</sources>
</moduleSet>
</moduleSets>
<includeBaseDirectory>false</includeBaseDirectory>
Here is what we end up with:
Make sure -DrepositoryId=Auc, Auc is the deployment id you set in your setting.xml
You have to use the Maven Assembly Plugin to create the tar.gz and then you can deploy it as usual with
and the right settings.xml available on Jenkins with credentails as needed for the deployment.