eclipsemavengoogle-app-enginegwtdatanucleus

Cant get datanuecleus 3.1.3 from maven


Trying to solve the error

Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class

I found several posts explaining it could be caused by using incompatible versions of datanueclus dependencies.

So Im downgrading some of the versions I was using to use a set I think is compatible (see pom.xml below) But my problem is maven doesnt get datanueclus-core 3.1.3 for me. It just gets the latest version 5.2.5 even if I specifically ask for 3.1.3

How can I solve this? If I ask for 5.2.4 it gets that one without problem. But if I try to get 3.1.3 it just gets the latest one.

datanueclues-core on Maven dependencies:

enter image description here

datanueclues-core on pom:

enter image description here

pom.xml:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>

  <groupId>bbva.cib</groupId>
  <artifactId>Aprov</artifactId>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
    
    <!-- WebApp/War Output Directory -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <!-- for hot reload of the web application-->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <sourceDirectory>src</sourceDirectory>    
    
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>libraries-bom</artifactId>
        <version>14.4.1</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
           <groupId>com.google.gwt</groupId>
           <artifactId>gwt</artifactId>
           <version>2.7.0</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
    </dependencies>
   </dependencyManagement>

  <dependencies>
    <!-- Compile/runtime dependencies -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>2.3.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>1.9.83</version>
    </dependency>
    <dependency>
        <groupId>com.google.endpoints</groupId>
        <artifactId>endpoints-framework</artifactId>
        <version>2.2.1</version>
    </dependency>
    
    <!-- Test Dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.4.5</version>
        <scope>provided</scope>         
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.4.5</version>
        <scope>provided</scope>         
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.12</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.12</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-excelant</artifactId>
        <version>3.12</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-examples</artifactId>
        <version>3.12</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>3.12</version>
    </dependency>   
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.3.1</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/com.google.gwt/gwt-servlet -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <scope>runtime</scope>
    </dependency>

     <dependency>
         <groupId>com.google.gwt</groupId>
         <artifactId>gwt-user</artifactId>
         <scope>provided</scope>
     </dependency>
     <dependency>
         <groupId>com.google.gwt</groupId>
         <artifactId>gwt-dev</artifactId>
         <scope>provided</scope>
     </dependency>
     
    
    <dependency>
             <groupId>org.datanucleus</groupId>
              <artifactId>datanucleus-maven-plugin</artifactId>
         <version>3.2.0-m2</version>
    </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>javax.jdo</artifactId>  
            <version>3.2.0-m6</version>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>3.1.3</version>
              <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-api-jdo</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
             <groupId>org.datanucleus</groupId>
             <artifactId>datanucleus-api-jpa</artifactId>
             <version>3.1.3</version>
        </dependency>
        
        <dependency>
            <groupId>com.google.appengine.orm</groupId>
            <artifactId>datanucleus-appengine</artifactId>
            <version>2.1.2</version>
        </dependency>
    
    
  </dependencies>


  <build>
    <!-- for hot reload of the web application-->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>2.4.0</version>
      </plugin>
      <plugin>
         <groupId>org.eclipse.jetty</groupId>
         <artifactId>jetty-maven-plugin</artifactId>
          <version>9.4.34.v20201102</version>
      </plugin>
      
     
      <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.7.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                    documentation at codehaus.org -->
                <configuration>
                    <runTarget>Aprov.html</runTarget>
                    <hostedWebapp>${webappDirectory}</hostedWebapp>
                    <superDevMode>false</superDevMode>
                    <sourceLevel>1.7</sourceLevel>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>maven-datanucleus-plugin</artifactId>
                <version>3.2.0-m1</version>
                <configuration>
                    <log4jConfiguration>${webappDirectory}/WEB-INF/log4j.properties</log4jConfiguration>
                    <api>JDO</api>
                        <persistenceUnitName>transactions-optional</persistenceUnitName>
                    <verbose>true</verbose>
                    <enhancerName>ASM</enhancerName>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
               
            </plugin>
          </plugins>
          </pluginManagement>
  </build>
</project>

Please, also check if my versions are compatible. I try to follow this https://code.google.com/archive/p/datanucleus-appengine/wikis/Compatibility.wiki but Im not sure I understand.

Thanks in advance


Solution

  • It sounds like some other dependency has version 5.2.4 as a dependency.

    In your <dependencyManagement> section you need to force the version, like this:

    <dependency>
       <groupId>org.datanucleus</groupId>
       <artifactId>datanucleus-maven-plugin</artifactId>
       <version>3.2.0-m2</version>
    </dependency>
    

    And in your regular <dependencies> section you should specify the artifact without the version, like this:

    <dependency>
       <groupId>org.datanucleus</groupId>
       <artifactId>datanucleus-maven-plugin</artifactId>
    </dependency>