idea的maven执行install时报错:
Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging
解决方法:
原因是执行install来打包package的时候,使用了unpack工具顺便把artifactItems指定依赖的包也install到jar中去,但是却找不到这个依赖包或者这个依赖包还没使用install打包出来。
例如下面代码:
假如我要执行common-auth模块的intall,想要install打包的时候也把framework模块的jar包打到common-auth的jar包中,就可以通过unpack来实现,但是我的错误就是误加了下面代码中的红色代码,红色代码的意思就是把自己也打包进去,本来不加红色代码就可以install这个common-auth模块的代码,因为我是执行的是common-auth的install,所以多此一举,去掉红色部分即可。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.cloud</groupId>
<artifactId>framework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>target/classes</outputDirectory>
<includes>**/*</includes>
</artifactItem>
<artifactItem>
<groupId>com.cloud</groupId>
<artifactId>common-auth</artifactId>
<version>0.0.1-SNAPSHOT</version>
<classifier>core</classifier>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>target/classes</outputDirectory>
<includes>**/*</includes>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
本文链接:http://www.yayihouse.com/yayishuwu/chapter/1412