m2e阴影食“项目主产物不存在". [英] m2e shade eclipse "project main artifact does not exist"
问题描述
我正在尝试制作一个部署软件包,该软件包将我的maven模块的所有依赖项捆绑到eclipse中的另一个maven项目中.
I'm trying to make a deployment package that bundles all the dependencies of my maven module that has dependencies to another maven project in eclipse.
我的pom.xml中有这个
I have this in my pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.proj</groupId>
<artifactId>AAA</artifactId>
<version>0.0.2-SNAPSHOT</version>
<name>btc</name>
<dependencies>
<dependency>
<groupId>com.another.proj</groupId>
<artifactId>BBB</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.group.id.Launcher1</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我在日食中使用了"m2 Maven Build",目标是"org.apache.maven.plugins:maven-shade-plugin:shade",并在"Resolve Workspace工件"上打了勾.
I use that "m2 Maven Build" in eclipse with the goal "org.apache.maven.plugins:maven-shade-plugin:shade" and the "Resolve Workspace artifacts" ticked.
失败了
--- maven-shade-plugin:1.6:shade (default-cli) @ AAA ---
[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR] supported. Please add the goal to the default lifecycle via an
[ERROR] <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR] remove this binding from your POM such that the goal will be run in
[ERROR] the proper phase.
这时我没主意了.
推荐答案
[错误]项目主工件不存在.可能有以下内容
[ERROR] The project main artifact does not exist. This could have the following
我们最近遇到了这个问题.为我们解决的是不做mvn shade:shade
,而是使用:
We were getting this problem recently. What resolved it for us was to not do mvn shade:shade
but instead use:
mvn package
这会在运行shade插件之前 进行其他编译和打包,因此主类在类路径中可用.
This does additional compilation and package work before running the shade plugin and so the main class was available on the classpath.
这篇关于m2e阴影食“项目主产物不存在".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!