0

I am adding pluginManagement to avoid Failed to execute goal org.apache.openjpa:openjpa-maven-plugin:3.0.0:enhance (enhancer) on project Execution enhancer of goal org.apache.openjpa:openjpa-maven-plugin:3.0.0:enhance failed:

Error. but when I add pluginManagement it stops creating jar for my project.

    <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>

If I remove pluginManagement from pom then Jar is getting created.

K.Nicholas
  • 10,956
  • 4
  • 46
  • 66
  • it would be quite normal to see that behaviour. What plugin management is not to activate any plugins but to configure them in case they are activated. Unless the plugin you configure in pluginManagement is a standard plugin that is part of the build in any case, that declaration will noth ave any effect, if no plugins are declared explicitly. – Matthias Oct 22 '18 at 14:23

1 Answers1

1

My guess is that you just wrapped your <plugins> tag in a <pluginManagement> tag, which does not do what you want. I suggest you read the documentation to understand the relationship between plugin and pluginManagement. See also another post on StackOverflow.

As to your underlying problem: I guess the error you mention is an Eclipse error. It is emitted by the m2e plugin which requires a connector for each maven plugin in your pom.

You can usually come up with a connector (if it is not found on the Eclipse Marketplace) by typing " m2e connector" into your favorite search engine.

In this case you might want to install this: https://github.com/beskow/openjpa-maven-connector

David
  • 3,787
  • 2
  • 29
  • 43