【发布时间】:2019-03-26 14:18:37
【问题描述】:
我正在添加 pluginManagement 以避免 无法在项目上执行目标 org.apache.openjpa:openjpa-maven-plugin:3.0.0:enhance (enhancer) 目标 org.apache.openjpa:openjpa-maven-plugin:3.0.0:enhance 的执行增强器失败:
错误。但是当我添加 pluginManagement 时,它会停止为我的项目创建 jar。
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.test.testApplication</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<includes>**/tablemodels/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
<persistenceXmlFile>src/main/resources/META-INF/persistence.xml</persistenceXmlFile>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
如果我从 pom 中删除 pluginManagement,那么 Jar 就会被创建。
【问题讨论】:
-
看到这种行为是很正常的。插件管理不是激活任何插件,而是配置它们以防它们被激活。除非您在 pluginManagement 中配置的插件是标准插件,并且无论如何都是构建的一部分,否则如果没有明确声明任何插件,则该声明将没有任何效果。
标签: java spring maven spring-boot