4

Summary:
Running "mvn war:war" fails with errors including:
"The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6".

I'd chalk it up to the fact that I'm a Maven noob but I see that other people have posted to the openid4java web site stating jars are missing from Maven central for openid4java.

Details:
I'm trying to get up to speed with openid4java by running the Simple-OpenID sample app that's included in the latest version of openid4java (0.9.6.662).

According to the Readme "This demo requires apache Maven2 to build". The Readme also states "The mvn war:war task should create a war file which can be deployed by copying the war file".

Up to now I've been getting by with Ant and the Mavent Ant Tasks but I figured I'd bite the bullet today and install Maven 3.0.3. I followed the install instructions and can now successfully run "mvn --version"

When I run "mvn war:war" a number of files do indeed get downloaded to my local repository but ultimately the build fails with the following excerpted message:

[ERROR] Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project simple-openid: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:196)

Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project org.openid4java:simple-openid:war:0.9.6: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure 

Caused by: org.sonatype.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in 

Am I doing something wrong here or are the jars actually missing from the Maven repository?

Justin
  • 6,031
  • 11
  • 48
  • 82

5 Answers5

4

I was able to resolve this problem by adding <type>pom</type> to the pom.xml. I found the answer in the OpenID4Java google group in this thread.

Here's what the thread in the google group said:

I mean you should add "pom" to the dependency section of openid4java in your pom.xml:

   <dependency>
         <groupId>org.openid4java</groupId>
         <artifactId>openid4java-consumer</artifactId>
         <!--artifactId>openid4java-server</artifactId-->
         <!--artifactId>openid4java-infocard</artifactId-->
         <!--artifactId>openid4java-xri</artifactId-->
         <!--artifactId>openid4java</artifactId-->
         <!--artifactId>openid4java-full</artifactId-->
         <version>0.9.6</version>
         <type>pom</type> <-----------------------This line can not be omitted.
    </dependency>

The type of openid4java-consumer/openid4java-server/.... are all "pom" not "jar". The jar file is in openid4java-nodeps which is depended by openid4java-consumer/openid4java-server...

Justin
  • 6,031
  • 11
  • 48
  • 82
  • Being a total maven noob, I cannot make this work. Which pom exactly needs editing? Which one in the repository or in the included samples pack? – Steven Dec 09 '12 at 10:14
1

This is what I did to make it compile and run:

  1. Go to your m2 or maven central repository,
  2. org->openID4java->openID4java->0.9.6 and edit openid4java-0.9.6.pom file and add pom to the dependencies which does not have jar
  3. org->openID4java->openid4java-consumer-SampleConsumer->0.9.6 and edit openid4java-consumer-SampleConsumer-0.9.6.pom file and add pom to the artifact of openId-consumer
  4. org->openID4java->openid4java-openid4java-server-SampleServer->0.9.6 and edit openid4java-server-SampleServer-0.9.6.pom file and add pom to the artifact of openId- server
  5. org->openID4java->openid4java-server-JdbcServerAssociationStore-0.9.6 and open the pom file and add the pom to the openID-server artifact.

fusing Eclipse, then right click project and maven and update dependency you are ready to go, for maven tool user, directly compile and you are ready to roll

Somnath
  • 11
  • 1
1

Another way to resolve the dependency in Grails is to add maven repository "https://oss.sonatype.org/content/repositories/openid4java/" and put "openid4java-nodeps" as the artifact.

repositories {
    grailsPlugins()
    grailsHome()
    grailsCentral()
    mavenCentral()      
    mavenRepo "https://oss.sonatype.org/content/repositories/openid4java/"
}

dependencies {
    runtime('mysql:mysql-connector-java:5.1.19',
            'org.apache.httpcomponents:httpclient:4.2',
            'org.openid4java:openid4java-nodeps:0.9.6') { excludes "xml-apis" }
}
Tommy Tang
  • 11
  • 1
1

Caused by: org.sonatype.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: org.openid4java:openid4java:jar:0.9.6, org.openid4java:openid4java-consumer:jar:0.9.6, org.openid4java:openid4java-server:jar:0.9.6, org.openid4java:openid4java-server-JdbcServerAssociationStore:jar:0.9.6, org.openid4java:openid4java-consumer-SampleConsumer:jar:0.9.6, org.openid4java:openid4java-server-SampleServer:jar:0.9.6: Failure to find org.openid4java:openid4java:jar:0.9.6 in

You need to either add a <repository> to your project containing these artifacts or install them to your local repository.

Try https://oss.sonatype.org/content/repositories/openid4java/ (found at MavenHowTo)

n00begon
  • 3,503
  • 3
  • 29
  • 42
matt b
  • 138,234
  • 66
  • 282
  • 345
  • If I understand you correctly (and remember I'm pretty much a Maven noob), you are suggesting that I either specify a specific online repository for Maven to search for the Jars or take the jar that I downloaded directly from openid4java's website and place them in my local Maven repository. It looks to me the jars for version 0.9.6 are also missing from the repository you suggested (oss.sonatype.org) and you found listed in the MavenHowTo wiki page on the openid4java website. Does that make sense that the jars are missing there? I see jars for the previous version 0.9.5. – Justin Jul 01 '11 at 14:12
  • Regarding the other suggestion of manually installing the jars to my local repository makes sense accept for one thing. I have a single jar (openid4java-0.9.6.jar) which I downloaded from openid4java's website but it seems Maven is trying to download several different openid4java related jars (openid4java-consumer, openid4java-server, etc.). The jar I do have has classes for openid4java-consumer, openid4java-server, etc. so I'm not sure if it would need to be broken up into several jars or what. – Justin Jul 01 '11 at 14:16
  • I think I'll try taking the dependent jars Maven was able download and packing it up with the openid4java-0.9.6.jar and see where that gets me. Sorry for the multiple comments but I ran out of room. :) Many thanks for your response – Justin Jul 01 '11 at 14:17
0

Do the maven install package for every depency openid4java-xxx failed as folow:

  1. run the ant build task inside your openid4java-0.9.6 directory

  2. then execute:

    mvn install:install-file -DgroupId=org.openid4java -DartifactId=openid4java-consumer -Dversion=0.9.6 -Dpackaging=jar -Dfile=<<change_this_path_to>>build\openid4java.jar
    
    mvn install:install-file -DgroupId=org.openid4java -DartifactId=openid4java-server -Dversion=0.9.6 -Dpackaging=jar -Dfile=<<change_this_path_to>>build\openid4java.jar
    
    mvn install:install-file -DgroupId=org.openid4java -DartifactId=openid4java-server-JdbcServerAssociationStore -Dversion=0.9.6 -Dpackaging=jar -Dfile=<<change_this_path_to>>build\openid4java.jar
    
    mvn install:install-file -DgroupId=org.openid4java -DartifactId=openid4java-consumer-SampleConsumer -Dversion=0.9.6 -Dpackaging=jar -Dfile=<<change_this_path_to>>build\openid4java.jar
    
    mvn install:install-file -DgroupId=org.openid4java -DartifactId=openid4java-server-SampleServer -Dversion=0.9.6 -Dpackaging=jar -Dfile=<<change_this_path_to>>build\openid4java.jar
    

And that should do it!

kapex
  • 28,903
  • 6
  • 107
  • 121