I have tried to add a goal to my maven lifecycle with the following pom part. I defined a new plugin and configured it with phase and execute information.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<includes>**/entity/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<connectionDriverName>com.ibm.db2.jcc.DB2Driver</connectionDriverName>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
<sqlFile>${project.build.directory}/database.sql</sqlFile>
</configuration>
<executions>
<execution>
<id>sql</id>
<phase>generate-resources</phase>
<goals>
<goal>sql</goal>
</goals>
</execution>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Then I run maven with mvn:install
But the plugin is not run?
Make sure that there is a dependency on the plugin and that the plugin is in build/plugin
not build/pluginmanagement/plugin
.
Try with something like this:
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<includes>**/entity/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<connectionDriverName>com.ibm.db2.jcc.DB2Driver</connectionDriverName>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
<sqlFile>${project.build.directory}/database.sql</sqlFile>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<executions>
<execution>
<id>sql</id>
<phase>generate-resources</phase>
<goals>
<goal>sql</goal>
</goals>
</execution>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With