解决:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty. 把工程依赖的jar包打到入jar中

前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。

1. 执行 mvn clean install 报错:

Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty.

2. 我只是想把工程依赖的jar包打到 最后的jar包中。

pom 中加上配置,会生成2个 jar ,用带有依赖的那个 jar 就行。( 如下文中的xxx-0.0.1-SNAPSHOT-jar-with-dependencies.jar )

          <plugin>
                <artifactId>maven-assembly-plugin</artifactId>                
                <version>3.3.0</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>singles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

3. 特别注意:版本一定要是3.3.0,或者查官网找最新文档中的版本。我之前用的是2.4.1,就一直报如题的错。

只是改为官方文档上的版本就可。文档地址:http://maven.apache.org/plugins/maven-assembly-plugin/usage.html

生成的jar 如:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值