使用Jenkins将tar.gz发布到Nexus [英] Using Jenkins to publish tar.gz to Nexus
问题描述
这是我要解决的问题:
- 从Github到本地目录D的结帐代码
- 在目录D中运行configure命令
- 为目录创建tar.gz
- 将taz.gz文件上传到Nexus
我陷入了第3步: -我可以在Maven pom.xml文件中指定版本,但是有没有一种方法可以在每次运行Jenkins时自动创建一个构建版本? -如果我在pom.xml文件中指定tar.gz,则会得到:未知包装:gz @第6行,第13列
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
如果我在包装内指定了jar,则没有错误,并且文件已成功上传到Nexus.
If I specify jar inside packaging, there is no error, and files are upload to Nexus successfully.
任何建议都会有所帮助,谢谢!
Any advice would help, thanks!
==
遵循建议,我使用的是Assembly Plugin,但仍无法为Directory RE创建tar.gz
follow suggestion, I am using Assembly Plugin, but still having trouble create tar.gz for Directory RE
这是我的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>
这是我的format.xml文件,RE目录是我检出代码并想要为其创建tar.gz的地方
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>
推荐答案
我们最后得到的是:
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
确保-DrepositoryId = Auc,Auc是您在setting.xml中设置的部署ID
Make sure -DrepositoryId=Auc, Auc is the deployment id you set in your setting.xml
<server>
<id>Auc</id>
<username>deployment</username>
<password>deployment123</password>
</server>
这篇关于使用Jenkins将tar.gz发布到Nexus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!