2015-10-14 40 views
0

這是我試圖解決的問題:從GitHub使用詹金斯發佈的tar.gz的Nexus

  1. 結賬代碼到本地目錄d
  2. 運行configure命令裏面的目錄d
  3. 創建爲tar.gz的目錄
  4. 上傳taz.gz文件的Nexus

我停留在步驟3: - 我可以指定在v在Maven pom.xml文件中使用ersion,但是有沒有辦法在每次運行Jenkins時自動創建構建版本? - 如果我在pom.xml文件中指定了tar.gz,我會得到:未知的包裝:gz @ line 6,column 13

如果我在包裝內指定jar,沒有錯誤,並且文件上傳到Nexus成功。

任何意見將有所幫助,謝謝!

==

後續建議,我使用Assembly插件,但仍然有問題的目錄RE

這裏創建的tar.gz是我的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的地方

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

+0

使用Maven組裝 –

+0

可能的複製[可以連結或Artifactory存儲簡單的tar.gz文物?](https://stackoverflow.com/questions/13054950/can-nexus-or-artifactory-store-simple-tar-gz-artifacts) – rogerdpack

回答

0

您必須使用Maven Assembly Plugin創建tar.gz的,然後你可以根據需要與

mvn clean deploy 

和可用的權利的settings.xml上詹金斯與credentails部署照常進行部署。

3

下面是我們結束:

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

<server> 
    <id>Auc</id> 
    <username>deployment</username> 
    <password>deployment123</password> 
</server>