Pages

Friday, 8 June 2012

Override maven plugin dependencies

I met the problem about the conflict versions of datanucleus-core between the one I declared in pom dependencies section and the datanucleus-core dependency in datanucleus maven plugin.

The root cause is the datanucleus maven plugin always check for newest datanucleus-core version (it's declared  as (2.9, ) in maven-datanucleus-plugin pom), so the plugin get the datanucleus-core-3.1.0-m3 while the datanucleus-core used in my project is 3.0.5 and error happened.

The simple solution is to force the maven plugin to use datanucles-3.0.5

<plugin>
  <groupid>org.datanucleus</groupid>
  <artifactid>maven-datanucleus-plugin</artifactid>
  <version>3.0.1</version>
  <configuration>
    <api>JDO</api>
    <verbose>true</verbose>
  </configuration>
  <executions>
    <execution>
      <phase>compile</phase>
      <goals>
        <goal>enhance</goal>
      </goals>
    </execution>
  </executions>
  
  <dependencies>
    <dependency>
      <groupid>org.datanucleus</groupid>
      <artifactid>datanucleus-core</artifactid>
      <version>3.0.5</version>
    </dependency>
  </dependencies>
</plugin>

1 comment: