Eclipse Luna maven-jar-plugin执行不包括生命周期。

时间:2023-01-25 14:28:57

I have a maven java project (deploying to jboss, if that matters) that uses the maven-jar-plugin. This works fine using Eclipse Kepler. I'm now trying Luna (EE edition), and I'm now getting this error

我有一个maven java项目(如果有关系的话,部署到jboss)使用maven-jar-plugin。使用Eclipse Kepler可以很好地工作。我现在正在尝试Luna (EE版本),现在我正得到这个错误。

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-jar-plugin:2.5:jar (execution: make-a-jar, phase: compile)

in all my child .pom files (the maven-jar-plugin is specified in the parent .pom file, but the error points to the block in the child .poms).

在我的所有子文件中。pom文件(在父.pom文件中指定了maven-jar-plugin),但是错误指向了child .pom中的块。

In the .pom viewer, if I click on the error message in the Overview tab, it gives me the option to "Discover new m2e connectors". Clicking on this brings up the "m2e Marketplace" dialog and appears to do a bunch of work, but then just shows me an empty list. If I click "Finish", it tries to calculate dependencies, and then gives me this error:

在.pom查看器中,如果我单击Overview选项卡中的错误消息,它将提供给我“发现新的m2e连接器”的选项。点击它就会弹出“m2e Marketplace”对话框,并显示出大量的工作,但只显示了一个空列表。如果我点击“Finish”,它尝试计算依赖关系,然后给我这个错误:

Operation details
Cannot complete the request.  See the error log for details.
"m2e connector for mavenarchiver pom properties" will be ignored because a newer version is already installed. 

So it appears to be that maybe the maven-jar-plugin depends on a particular version of mavenarchiver, but Eclipse Luna EE comes with a newer version. Is there a way to fix this problem, or do I just have to wait for a newer version of maven-jar-plugin to be released? (I'm currently using version 2.5 of maven-jar-plugin, which is the latest that I'm aware of.)

因此,似乎maven-jar-plugin可能依赖于特定版本的mavenarchiver,但是Eclipse Luna EE有一个较新的版本。是否有办法解决这个问题,或者我只需要等待一个新版本的mavenar -jar-plugin发布?(我目前使用的是mavenjar -plugin的2.5版本,这是我所知道的最新版本。)

2 个解决方案

#1


1  

You can solve the problem when you change the phase of execution from compile to package (which is default lifecycle phase for jar goal).

当您将执行的执行阶段从编译转换为包(这是jar目标的默认生命周期阶段)时,您可以解决这个问题。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${maven-jar-plugin}</version>
            <executions>
              <execution>
                <phase>package</phase>  <!-- changed from compile to package -->
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>               
        </plugin>

#2


1  

I had a similar problem when trying to import Hadoop project in Eclipse. The solution above works... but I got "tired" of changing some of the pom files, and thought that the change would bite me later. So, another solution is: To avoid the messages in Eclipse regarding execution not covered by lifecycle, go to Windows -> Preferences -> Maven -> Errors/Warning and select Ignore for "Plugin execution not covered for Lifecycle.."

在尝试在Eclipse中导入Hadoop项目时,我遇到了类似的问题。上面的解决方案工作……但我对更改pom文件感到“厌倦”,并认为这种变化会在以后影响我。因此,另一个解决方案是:在Eclipse中避免在生命周期中不包括的执行消息,转到Windows ->首选项-> Maven ->错误/警告,并选择忽略“不包括生命周期的插件执行”。

#1


1  

You can solve the problem when you change the phase of execution from compile to package (which is default lifecycle phase for jar goal).

当您将执行的执行阶段从编译转换为包(这是jar目标的默认生命周期阶段)时,您可以解决这个问题。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${maven-jar-plugin}</version>
            <executions>
              <execution>
                <phase>package</phase>  <!-- changed from compile to package -->
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>               
        </plugin>

#2


1  

I had a similar problem when trying to import Hadoop project in Eclipse. The solution above works... but I got "tired" of changing some of the pom files, and thought that the change would bite me later. So, another solution is: To avoid the messages in Eclipse regarding execution not covered by lifecycle, go to Windows -> Preferences -> Maven -> Errors/Warning and select Ignore for "Plugin execution not covered for Lifecycle.."

在尝试在Eclipse中导入Hadoop项目时,我遇到了类似的问题。上面的解决方案工作……但我对更改pom文件感到“厌倦”,并认为这种变化会在以后影响我。因此,另一个解决方案是:在Eclipse中避免在生命周期中不包括的执行消息,转到Windows ->首选项-> Maven ->错误/警告,并选择忽略“不包括生命周期的插件执行”。