首页 > 解决方案 > 阻止 Eclipse/Maven 调用一个特定的插件

问题描述

我在 Eclipse 中有一个 Maven 项目,它不仅构建主 jar 文件,还运行frontend-maven-plugin。这个插件需要永远运行,并且 Eclipses 坚持在启动时调用它一次,然后在随机时间调用它。

我需要它仅在部署时运行此插件,并在开发过程中停止打扰我。我已将每个执行绑定到部署阶段,当我从命令行运行 Maven 时,一切正常。“mvn deploy”运行插件,“mvn install”不运行。

    <plugin>
        <!-- This is from https://blog.codecentric.de/en/2018/04/spring-boot-vuejs/ 
            It does the front end build by invoking the npm build. -->
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.8.0</version>

        <configuration>
            <workingDirectory>admin</workingDirectory>
        </configuration>

        <executions>
            <!-- Install our node and npm version to run npm/node scripts -->
            <execution>
                <id>install node and yarn</id>
                <goals>
                    <goal>install-node-and-yarn</goal>
                </goals>
                <phase>deploy</phase>
                <configuration>
                    <nodeVersion>v14.15.1</nodeVersion>
                    <yarnVersion>v1.22.10</yarnVersion>
                </configuration>
            </execution>
            <!-- Install all project dependencies -->
            <execution>
                <id>yarn install</id>
                <goals>
                    <goal>yarn</goal>
                </goals>
                <phase>deploy</phase>
                <!-- optional: default phase is "generate-resources" -->
            </execution>
            <!-- Build and minify static files -->
            <execution>
                <!-- Yarn/Nuxt still uses npm run build to build the dist -->
                <id>yarn run build</id>
                <goals>
                    <goal>yarn</goal>
                </goals>
                <phase>deploy</phase>
                <configuration>
                    <arguments>run build</arguments>
                </configuration>
            </execution>
        </executions>
    </plugin>

问题是 Eclipse 在开发时不断调用插件并在我等待它时将我关闭。我如何让它停止?

标签: javaeclipsemaven

解决方案


如果您<?m2e ignore?>按照中所述应用于插件,它应该可以工作

https://www.eclipse.org/m2e/documentation/release-notes-17.html


推荐阅读