maven打包指定名称并去除jar-with-dependencies后缀
发布日期:2021-05-07 13:21:42 浏览次数:10 分类:原创文章

本文共 1842 字,大约阅读时间需要 6 分钟。

在mavne中打包默认的一般为 a r t i f a c t I d . {artifactId}. artifactId.{version}.${packageing}
有些时候需要指定maven打包的名称,可以进行如下配置:
在pom.xml中build配配置中增加<finalName>yourName</finalName>,如果想去除jar-with-dependencies后缀,则在assembly配置中增加<appendAssemblyId>false</appendAssemblyId>

    <build>        <finalName>yourName</finalName>    <plugins>    <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-compiler-plugin</artifactId>        <version>3.1</version>        <configuration>            <source>1.7</source>            <target>1.7</target>            <encoding>UTF-8</encoding>        </configuration>    </plugin>    <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-assembly-plugin</artifactId>        <version>2.4</version>        <configuration>            <archive>                <manifest>                    <mainClass></mainClass>                </manifest>            </archive>            <descriptorRefs>                <descriptorRef>                    jar-with-dependencies                </descriptorRef>            </descriptorRefs>          ` <appendAssemblyId>false</appendAssemblyId>        </configuration>        <executions>            <execution>                <id>make-assembly</id>                <phase>package</phase>                <goals>                    <goal>single</goal>                </goals>            </execution>        </executions>    </plugin>    <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-source-plugin</artifactId>        <version>2.2.1</version>        <executions>            <execution>                <id>attach-sources</id>                <goals>                    <goal>jar-no-fork</goal>                </goals>            </execution>        </executions>    </plugin>    </plugins>    </build>
上一篇:java连接PostgresSQL,JDBC驱动
下一篇:java连接impala,jdbc,带kerberos认证登录

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年04月08日 01时28分27秒