This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Could not resolve dependencies for maven project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Could not resolve dependencies for maven project" Watch "Could not resolve dependencies for maven project" New topic
Author

Could not resolve dependencies for maven project

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Please refer to attachment for the snapshot of uploaded file structure in my local Nexus Sonatype server.

when I used command "mvn compile war:war", the following error indicated that the files are not found in my local nexus repositories, whereas it is supposed in the local repositories as shown in the attachment.


[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for ixsystems:ixsystems-registration:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 286, column 21
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building iXSystems Portal Products and Services Registration 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.liferay.portal:util-java:jar:5.2.8 is missing, no dependency information available
[WARNING] The POM for com.liferay.portal:util-bridges:jar:5.2.8 is missing, no dependency information available
[WARNING] The POM for com.liferay.portal:portal-kernel:jar:5.2.8 is missing, no dependency information available
[WARNING] The POM for com.liferay.portal:portal-impl:jar:5.2.8 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.063s
[INFO] Finished at: Fri Jun 24 14:17:44 EST 2011
[INFO] Final Memory: 5M/88M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ixsystems-registration: Could not resolve dependencies for project ixsystems:ixsystems-registration:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.liferay.portal:util-java:jar:5.2.8, com.liferay.portal:util-bridges:jar:5.2.8, com.liferay.portal:portal-kernel:jar:5.2.8, com.liferay.portal:portal-impl:jar:5.2.8: Failure to find com.liferay.portal:util-java:jar:5.2.8 in http://localhost:8081/nexus/content/groups/public/ 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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Very appreciate for any suggestion.

Thanks
Sam


[Thumbnail for nexus-sonatype.png]

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You're getting some warnings on your plugins. Prior to about Maven Version 3, plugins didn't need to specify versions, but that has now changed. No harm as of yet, but it's worth fixing.

You specified a number of Liferay artifacts as dependencies but they did not resolved properly, either because they weren't installed into the Maven repository and couldn't be downloaded or because the downloaded copies are defective (for example, because the disk containing your Maven cache filled up or there was a network error on download).

If the downloaded copies are defective, the quickest solutions is to go into your cache and delete them all ("$HOME/.m2/org/liferay" for Linux/Unix).

If these are artifacts that you had to manually add to the cache because they're not in a public Maven repository, delete them and try re-adding them.


Customer surveys are for companies who didn't pay proper attention to begin with.
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
I need these files. That s why I uploaded these artifacts to my local Nexus Sonatype server (as shown in my previous post above).
But I don't know how to reference them from the pom.xml file in my Maven project.

Here is my pom.xml file:



Thank you very much for your suggestion.
Sam
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

According to you Nexus screen shot, you used a groupId of com.liferay.portal for the liferay artifacts. But in the pom.xml you are using com.liferay (line 214)

By the way, if you click on any of the artifacts in Nexus, a window should unfold that gives you the full artifact name.

I looked at the screenshot again - you are missing the POM files in Nexus. And you are missing the SHA1 and MD5 has files. I suspect that you "uploaded" the liferay jars into Nexus by copying them into the file structure. Don't do that! Instead, use the upload capability built into Nexus or use the Maven deploy:deploy-file goal.


JBoss In Action
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Very appreciate for the suggestion.
I have implemented the fixes in Sonatype local server and the pom.xml file.
I have also remove c:/maven/repositories/com/liferay/* and let maven install the jar files by downloading liferay files from my local Sonatype storage, but I am still getting the same error.

Here is the error:



The pom.xml file is now look like this:



Attached is screenshot of my local Sonatype server.


Thanks again for your suggestion.

Sam


[Thumbnail for nexus-sonatype.png]

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
After maven downloaded liferay files from my local Sonatype server, I found the jar file is missing in my local repositories (eg. C:\maven\repository\com\liferay\portal\portal-impl\5.2.8).

The files contain in this folder (C:\maven\repository\com\liferay\portal\portal-impl\5.2.8) is:

portal-impl-5.2.8.jar.lastUpdated
portal-impl-5.2.8.pom.lastUpdated


I don't know what happen with the .jar file. Why portal-impl-5.2.8.jar and the *.sha1 files are missing?

Thanks
Sam
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Hello,

I used debug mode with maven commandline
mvn install:install-file -DgroupId=com.liferay.portal -DartifactId=portal-impl -Dversion=5.2.8 -Dfile=C:\repository\com\liferay\portal-impl\5.2.EESP4\portal-impl-5.2.8.jar -Dpackaging=jar -DgeneratePom=true -X


Now it prints a more descriptive error:

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
I have further corrected the error, but the installed directory still contains no .jar file.
Here is the output from the commandline:



The directory C:\maven\repository\com\liferay\portal\portal-impl\5.2.8\ does not contain .jar file:


_maven.repositories
portal-impl-5.2.8.jar.lastUpdated
portal-impl-5.2.8.pom



And executing maven commandline mvn compile war:war still failed:

sam@sam-PC /cygdrive/c/ixsystems-registration
$ mvn compile war:war
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for ixsystems:ixsystems-registration:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 286, column 21
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building iXSystems Portal Products and Services Registration 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.399s
[INFO] Finished at: Tue Jun 28 16:01:43 EST 2011
[INFO] Final Memory: 4M/55M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ixsystems-registration: Could not resolve dependencies for project ixsystems:ixsystems-registration:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.liferay.portal:util-java:jar:5.2.8, com.liferay.portal:util-bridges:jar:5.2.8, com.liferay.portal:portal-kernel:jar:5.2.8, com.liferay.portal:portal-impl:jar:5.2.8, com.liferay.portal:portal-service:jar:5.2.8: Failure to find com.liferay.portal:util-java:jar:5.2.8 in http://localhost:8081/nexus/content/groups/public/ 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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Thanks
Sam
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
I also executed mvn compile war:war -X, which prints the following error:

Embedded code moved to attachment.


[Download mvn.txt] Download

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Looking at the error:

[ERROR] Failed to execute goal on project ixsystems-registration: Could not resolve dependencies for project ixsystems:ixsystems-registration:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.liferay.portal:util-java:jar:5.2.8, com.liferay.portal:util-bridges:jar:5.2.8, com.liferay.portal:portal-kernel:jar:5.2.8, com.liferay.portal:portal-impl:jar:5.2.8, com.liferay.portal:portal-service:jar:5.2.8: Failure to find com.liferay.portal:util-java:jar:5.2.8 in http://localhost:8081/nexus/content/groups/public/ 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]

It looks like the listed artifacts are still not in either your local repository or in Nexus. Open your browser and loot at http://localhost:8081/nexus/content/groups/public/, then see if you can go to com/liferay/portal (final URL will be http://localhost:8081/nexus/content/groups/public/com/liferay/portal). You should have a directory for each artifact there.


By the way, in the future do not post these lengthy console outputs. Instead, redirect them to a file and attach the file. Right now this thread is pretty much unreadable. I edited the last post for you to do this, it would help if you did the same for the others.
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Peter Johnson wrote:Looking at the error:

[ERROR] Failed to execute goal on project ixsystems-registration: Could not resolve dependencies for project ixsystems:ixsystems-registration:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.liferay.portal:util-java:jar:5.2.8, com.liferay.portal:util-bridges:jar:5.2.8, com.liferay.portal:portal-kernel:jar:5.2.8, com.liferay.portal:portal-impl:jar:5.2.8, com.liferay.portal:portal-service:jar:5.2.8: Failure to find com.liferay.portal:util-java:jar:5.2.8 in http://localhost:8081/nexus/content/groups/public/ 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]

It looks like the listed artifacts are still not in either your local repository or in Nexus. Open your browser and loot at http://localhost:8081/nexus/content/groups/public/, then see if you can go to com/liferay/portal (final URL will be http://localhost:8081/nexus/content/groups/public/com/liferay/portal). You should have a directory for each artifact there.


By the way, in the future do not post these lengthy console outputs. Instead, redirect them to a file and attach the file. Right now this thread is pretty much unreadable. I edited the last post for you to do this, it would help if you did the same for the others.


liferay 5.2.8 is not on the following path:

http://localhost:8081/nexus/content/groups/public/com/liferay/portal/

Instead, there is only 6.0.6 as shown below:

http://localhost:8081/nexus/content/groups/public/com/liferay/portal/portal-impl/6.0.6/

the 6.0.6 was the one I downloaded from Maven repositories a while ago.

I just found that I have uploaded liferay 5.2.8 to the following path:

http://localhost:8081/nexus/content/repositories/Liferay-ee-sp4-local/com/liferay/portal/
eg.
http://localhost:8081/nexus/content/repositories/Liferay-ee-sp4-local/com/liferay/portal/portal-impl/5.2.8/

Have I messed up the path?
Do I have to upload 5.2.8 to http://localhost:8081/nexus/content/groups/public/com/liferay/portal/ so that Maven can find the file?

The following is how I created my liferay 5.2.8 repository:

Repository Information:

Repository ID: Liferay-ee-sp4-local
Repository Name: Liferay EE SP4 Local
Repository Type: hosted
Repository Policy: Release
Repository Format: maven2
Contained in groups:

should I enter "liferay" as the Repository Id?

Thanks
Sam


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not resolve dependencies for maven project