Reputation: 31252
I have the following pom.xml which works if I execute the mvn goal mvn hibernate3:hbm2java
directly. I now want to make it part of execution during generate-entity
phase. I have a few dependencies included in the plugin.
Here is the working pom.
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2java</name>
<implementation>jdbcconfiguration</implementation>
<outputDirectory>src/main/java</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/main/resources/reveng.xml</revengfile>
<propertyfile>src/main/resources/hibernate.properties</propertyfile>
<packagename>com.whatever.domain</packagename>
<jdk7>true</jdk7>
<ejb3>true</ejb3>
</componentProperties>
</configuration>
<dependencies>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.22</version>
</dependency>
</dependencies>
</plugin>
</plugins>
This works as expected when I execute mvn hibernate3:hbm2java
.
But I included execution section in my pom.xml. Now Eclipse prompts me with this error message
cvc-complex-type.2.4.a: Invalid content was found starting with element 'dependencies'. One of '{"http://
maven.apache.org/POM/4.0.0":inherited}' is expected.
Here is the modified pom.xml that has issues near the dependencies block
inside plugin
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-entity</id>
<phase>generate-entity</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2hbmxml</name>
<implementation>jdbcconfiguration</implementation>
<outputDirectory>src/main/java</outputDirectory>
</component>
<component>
<name>hbm2java</name>
<implementation>jdbcconfiguration</implementation>
<outputDirectory>src/main/java</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/main/resources/reveng.xml</revengfile>
<propertyfile>src/main/resources/hibernate.properties</propertyfile>
<packagename>com.whatever.domain</packagename>
<jdk7>true</jdk7>
<ejb3>true</ejb3>
</componentProperties>
</configuration>
<dependencies> --- Eclipse shows errors here
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.22</version>
</dependency>
</dependencies>
</execution>
</executions>
</plugin>
</plugins>
Upvotes: 1
Views: 424
Reputation: 9059
As mentions at "Guide to Configuring Plug-ins: Using the dependencies Tag", The dependencies
tags is only available at the plugin
level, not at the execution
level as the following example: -
<build>
<plugins>
<plugin>
<groupId>some-group</groupId>
<artifactId>some-artifact</artifactId>
<version>some-version</version>
...
<dependencies>
<dependency>
<groupId>some-dependency-group</groupId>
<artifactId>some-dependency-artifact</artifactId>
<version>some-dependency-version</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Upvotes: 1