Deploying assembly package with maven-release-plugin

前端 未结 2 699
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 02:45

We use Hudson and the maven-release-plugin to do the release builds. Now I have a project which contains an assembly that puts together all needed components and then packag

相关标签:
2条回答
  • 2020-12-24 02:49

    Meanwhile, I found 2 ways of doing what I wanted.

    The maven-build-helper-plugin allows to add additional entries to the list of artifacts that should be deployed:

        <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>build-helper-maven-plugin</artifactId>
             <version>1.3</version>
             <executions>
               <execution>
                 <id>attach-distribution</id>
                 <phase>package</phase>
                 <goals>
                   <goal>attach-artifact</goal>
                 </goals>
                 <configuration>
                   <artifacts>
                     <artifact>
                       <file>target/${pom.artifactId}-${pom.version}.tar.gz</file>
                       <type>tar.gz</type>
                     </artifact>
                   </artifacts>
                 </configuration>
               </execution>
             </executions>
           </plugin>
    

    The other is as simple as it gets and someone on the maven-user mailinglist pointed this out. Simple use the assembly:single goal instead of asssembly:assembly. This way the generated artifact is uploaded to the repository during the deploy phase.

        <execution>
            <id>dist-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal> <!-- that's all :) -->
            </goals>
        </execution>
    
    0 讨论(0)
  • 2020-12-24 03:07

    Deploying files is not part of the release plugin but of the deploy plugin (release doesn't deploy stuff anywhere by itself but you can configure the deploy plugin to be called during a release).

    Normally, the deploy plugin will deploy all artifacts to the remote repository but assemblies aren't artifacts; Maven can't use .tar.gz archives in its repository in any way, so it doesn't make sense to deploy them in the first place.

    If you insist to copy useless files into the repository, you must use deploy:deploy-file (see the docs) to deploy a file manually and configure the plugin with an execution to invoke it during the release step. But I still advise against it.

    What you're probably looking for is a way to upload an assembly somewhere automatically. I'm not aware of a plugin that does this.

    0 讨论(0)
提交回复
热议问题