Publish tar.gz file to Nexus

4,987 views
Skip to first unread message

Jason Tran

unread,
Oct 13, 2015, 11:07:38 PM10/13/15
to Jenkins Users
Hello there,

This is problem I am trying to solve:

1. checkout code from Github to a local directory D
2. run configure command inside directory D
3. create a tar.gz for directory
4. upload taz.gz file to Nexus

I am stuck at step 3:
- I can specify the verison in Maven pom.xml file, but is there a way to automatically create a build version every time Jenkins is run?
- If I specify <packaging>tar.gz</packaging> 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!

Karl Heinz Marbaise

unread,
Oct 14, 2015, 7:59:35 AM10/14/15
to jenkins...@googlegroups.com
Hi,

simplest solution is to use build-helper-maven-plugin

http://www.mojohaus.org/build-helper-maven-plugin/attach-artifact-mojo.html

Kind regards
Karl Heinz Marbaise

David Karlsen

unread,
Oct 14, 2015, 8:26:00 AM10/14/15
to jenkins...@googlegroups.com
The assembly plugin is also an alternative: http://maven.apache.org/plugins/maven-assembly-plugin/ (which can do creation of the archive, as well as attach it to he build).


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/561E0B57.7020900%40gmx.de.
For more options, visit https://groups.google.com/d/optout.



--

Jason Tran

unread,
Oct 14, 2015, 8:23:50 PM10/14/15
to Jenkins Users, da...@davidkarlsen.com
I tried to search for these plugins under Available tab of Jenkins Manage Plugins but couldn't find them. Are they appear as different names in Jenkins plugin?

Many thanks,

Daniel Beck

unread,
Oct 14, 2015, 8:29:58 PM10/14/15
to jenkins...@googlegroups.com

On 14.10.2015, at 22:23, Jason Tran <jason...@gmail.com> wrote:

> I tried to search for these plugins under Available tab of Jenkins Manage Plugins but couldn't find them. Are they appear as different names in Jenkins plugin?

They are Maven plugins. The proposed solutions are unrelated to Jenkins.

David Karlsen

unread,
Oct 14, 2015, 8:40:06 PM10/14/15
to jenkins...@googlegroups.com
Ah sorry - I just saw the one maven plugin mentioned and found the other better IMHO alternative.
Yes - they are indeed maven plugins.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jason Tran

unread,
Oct 14, 2015, 9:06:14 PM10/14/15
to Jenkins Users, da...@davidkarlsen.com
ok thanks! I guess I should re-post and clarify I am looking for solution within Jenkins.

Jason Tran

unread,
Oct 17, 2015, 1:53:57 AM10/17/15
to Jenkins Users, da...@davidkarlsen.com

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>
</assembly>

Jason Tran

unread,
Oct 23, 2015, 9:23:57 PM10/23/15
to Jenkins Users, da...@davidkarlsen.com
We end up using mvn deploy:

mvn deploy:deploy-file -DgroupId=Home -DartifactId=RE -Dversion=0.0.0.1-SNAPSHOT -Dpackaging=tar.gz -DrepositoryId=Auc -Durl=http://nexus1.ccorp.com/nexus/content/repositories/snapshots -Dfile=RE-0.0.0.1-SNAPSHOT.tar.gz

Ladislav Jech

unread,
Feb 24, 2019, 12:21:01 PM2/24/19
to Jenkins Users
Just being in same situation, I have some docker containers which are being used and configuration of multiple applications is being updated during time. I would like to export docker container into tar.xz and upload it to nexus as kind of latest available image. Will try this.
Reply all
Reply to author
Forward
0 new messages