简体   繁体   English

Maven发布插件jar-with-dependencies

[英]Maven release plugin jar-with-dependencies

I've got the maven-assembly-plugin section of the pom file made like this: 我已经将pom文件的maven-assembly-plugin部分制成如下:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.my.package.MyMainClass</mainClass>
                    </manifest>
                    <manifestEntries>
                        <Class-Path>.</Class-Path>
                    </manifestEntries>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
             <execution>
                 <id>make-assembly</id>
                 <goals>
                     <goal>single</goal>
                 </goals>
             </execution>
            </executions>
        </plugin>

and the maven-release-plugin like: 和Maven-release-plugin一样:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <goals>deploy</goals>
                <checkModificationExcludeList>pom.xml</checkModificationExcludeList>
                <tagNameFormat>@{project.version}</tagNameFormat>
                <providerImplementations>
                    <git>jgit</git>
                </providerImplementations>                  
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-jgit</artifactId>
                    <version>1.9.2</version>
                </dependency>
            </dependencies>
        </plugin>

I need to release for Archiva a jar-with-dependency file, but the release:perform command upploads only the jar without any dependencies inside. 我需要为Archiva释放一个jar-with-dependency文件,但是release:perform命令仅上载jar,而内部没有任何依赖关系。 What am I missing? 我想念什么?

Ok..I'll have to answer my own question. 好吧..我必须回答我自己的问题。 It was just missing the execution phase "package" into the assembly plugin. 它只是缺少执行阶段“打包”到程序集插件中。 This is the new one: 这是新的:

         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.my.package.MyMainClass</mainClass>
                    </manifest>
                    <manifestEntries>
                        <Class-Path>.</Class-Path>
                    </manifestEntries>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
             <execution>
                 <id>make-assembly</id>
                 <goals>
                     <goal>single</goal>
                 </goals>
             </execution>

             <!-- was missing the following one -->
             <execution>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>

            </executions>
        </plugin>

Thanks Sergey for pointing me on the package phase. 感谢谢尔盖(Sergey)在打包阶段向我指出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM