views:

55

answers:

2

Hi,

I have a maven project with a dependency (datanucleus-db4o). This dependency has itself a dependency on db4o (db4o:db4o:jar:7.12.126.14142-all-java5).

Now maven says:

09.09.10 19:43:09 MESZ: Missing artifact db4o:db4o:jar:7.12.126.14142-all-java5:compile

I am new to maven. Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way? m2eclipse can't download it. I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.

Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:

Am I doing something wrong?

Thanks in advance.

Here is the relevant part of the pom.xml...

<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-core</artifactId>
  <version>2.2.0-m1</version>
  <type>jar</type>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-db4o</artifactId>
  <version>2.1.1</version>
  <type>jar</type>
  <scope>compile</scope>
</dependency>

and here is the relevant part of the pom.xml of

<dependency>
  <groupId>db4o</groupId>
  <artifactId>db4o</artifactId>
  <version>7.12.126.14142-all-java5</version>
</dependency>
+2  A: 

Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way?

I'm not sure I understood the question... Anyway, there is indeed something wrong with the db4o:db4o dependency of the datanucleus-db4o artifact: it is not available in Maven central nor in the DataNucleus repository. I don't understand how users are supposed to use the datanucleus-db4o artifact.

I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.

Not sure what you did exactly but maybe the following will work: exclude the dependency that can't be resolved and replace it with some equivalent from the db4o repository.

<dependencies>
  ...
  <dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-db4o</artifactId>
    <version>2.1.1</version>
    <type>jar</type>
    <scope>compile</scope>
    <exclusions>
      <exclusion>
        <groupId>db4o</groupId>
        <artifactId>db4o</artifactId>
      </exclusion>
    </exclusions>
  </dependency>
  <dependency>
    <groupId>com.db4o</groupId>
    <artifactId>db4o-full-java5</artifactId>
    <version>7.12-SNAPSHOT</version>
  </dependency>
</dependencies>
<repositories>
  ...
  <repository>
    <id>db4o</id>
    <url>https://source.db4o.com/maven&lt;/url&gt;
  </repository>
</repositories>

I have no idea if this will work of course.

Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:

Can't say since you didn't post the error. But give the above a try.

Pascal Thivent
Thx, I solved it now another way. I'll post it now...
PageFault
A: 

The required file is not in the maven repositories, but it is in the datanucleus zip file (that one with all dependencies). Look into the /deps folder.

I unpacked it and installed it into the local maven repository with this command:

./mvn install:install-file -Dfile=/home/myUser/Downloads/db4o-7.12.126.14142-all-java5.jar -DgroupId=db4o -DartifactId=db4o -Dversion=7.12.126.14142-all-java5 -Dpackaging=jar

After that it is found by maven. Now there are other problems going on. I'll try to solve them myself...

Seems like the JDO or Datanucleus stuff is not well organized at the moment. I think they refactored some classes and now they can't be found at some versions and implementations are incompatible with the api and such stuff.

PageFault
If you don't mind your build not being portable, that's a solution. I prefer to rely on artifacts from public repositories personally.
Pascal Thivent
Yes, you are right. Due to all the problems I managed the dependency resolution manually now. I hope this will only be a temporary situation and the next version of JDO and Datanucleus will be published soon (just a wish).
PageFault