hibernate - error when including dependency within the plugin under execution in maven -
i have following pom.xml works if execute mvn goal mvn hibernate3:hbm2java
directly. want make part of execution during generate-entity
phase. have few dependencies included in plugin.
here 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 expected when execute mvn hibernate3:hbm2java
.
but included execution section in pom.xml. eclipse prompts me error message
cvc-complex-type.2.4.a: invalid content found starting element 'dependencies'. 1 of '{"http:// maven.apache.org/pom/4.0.0":inherited}' expected.
here modified pom.xml has issues near 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>
as mentions @ "guide configuring plug-ins: using dependencies tag", dependencies
tags available @ plugin
level, not @ execution
level 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>
Comments
Post a Comment