2011-06-21 30 views
7

Son olarak bir zip dosyasıyla sonuçlanan Ant ile bir sürü iş yapmak için maven-antrun-plugin kullanıyorum. Zip dosyasını maven sunucumuza (Artifactory) dağıtmak isterim. Maven-antrun-kısmı amaçlandığı gibi çalışır ve başarılı bir şekilde zip dosyasını oluşturur;maven-antrun-plugin ile oluşturulan bir zip dosyasını nasıl dağıtabilirim?

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy (default-deploy) on project projectname: The packaging for this project did not assign a file to the build artifact

Benim POM dosyası aşağıdaki gibidir: Ben mvn -U -pl projectname clean deploy ile (üst POM itibaren) bu çağırmak

<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.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.company.division</groupId> 
    <artifactId>projectname</artifactId> 
    <version>1.0.0-SNAPSHOT</version> 
    <packaging>pom</packaging> 

    <parent> 
     <groupId>com.company.product</groupId> 
     <artifactId>parentproject</artifactId> 
     <version>1.0.0</version> 
    </parent> 

    <distributionManagement> 
     <snapshotRepository> 
      <id>artifactory</id> 
      <name>artifactory-snapshots</name> 
      <url>http://localartifactoryserver/artifactory/libs-snapshot-local</url> 
      <uniqueVersion>false</uniqueVersion> 
     </snapshotRepository> 
    </distributionManagement> 

    <dependencies> 
     <!-- Some dependencies... --> 
    </dependencies> 

    <build> 
     <plugins> 
      <!-- Compiler plugin --> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
        <encoding>UTF8</encoding> 
        <optimize>true</optimize> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-antrun-plugin</artifactId> 
       <version>1.6</version> 
       <executions> 
        <execution> 
         <id>compile</id> 
         <phase>compile</phase> 
         <configuration> 
          <target> 
           <!-- Do lots of other stuff with Ant. --> 

           <!-- Create a zip file. --> 
           <zip basedir="mydir" destfile="${WORKSPACE}/MyZip.zip" /> 
          </target> 
         </configuration> 
         <goals> 
          <goal>run</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-deploy-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <groupId>${project.groupId}</groupId> 
        <artifactId>${project.artifactId}</artifactId> 
        <version>${project.version}</version> 
        <packaging>zip</packaging> 
        <file>MyZip.zip</file> 
        <url>${project.distributionManagement.snapshotRepository.url}</url> 
       </configuration> 
       </plugin> 
     </plugins> 
    </build> 
</project> 

ben esnasında yukarıda belirtilen hata alıyorum ancak dağıtım aşağıdaki hata iletisiyle başarısız olur dağıtım aşaması. Yanlış yaptığımı veya bunu nasıl düzeltebileceğimi bilen var mı?

cevap

10
benim için çalıştı çözeltisi (I ideal ise, oldukça hackish görünüyor emin değilim) deploy:deploy-file hedefe geçmek oldu

:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-deploy-plugin</artifactId> 
    <version>2.6</version> 
    <goals> 
     <goal>deploy-file</goal> 
    </goals> 
    <configuration> 
     <repositoryId>artifactory</repositoryId> 
     <packaging>zip</packaging> 
     <generatePom>true</generatePom> 
     <url>${project.distributionManagement.snapshotRepository.url}</url> 
     <artifactId>${project.artifactId}</artifactId> 
     <groupId>${project.groupId}</groupId> 
     <version>${project.version}</version> 
     <file>${WORKSPACE}/MyZip.zip</file> 
    </configuration> 
</plugin> 

ve açıkça çağırmak:

mvn -U -X -pl projectname clean install deploy:deploy-file 
+0

Projenizin " pom" olduğunu varsayarsak, bu şekilde bir projenin geçişini yaparsanız, böyle bir projenin geçiş bağımlılıklarının çözülmeyeceği (daha sonra diğer projeler tarafından) önerilmelidir. – carlspring

+0

Çözülecek olan şey artefaktın kendisi olacaktır. – carlspring

+0

Bir hayat kurtarıcı. Bunu komut satırında yapmak zorundaydım. Bir pom.xml dosyasında nasıl yapılacağını bilmek güzel. Bir öğesi ekleyin ve bir içinde dağıtmak eklerseniz –

İlgili konular