Maven dependencies missing
I am working on a large open source Semantic CMS named Clerezza, an Apache incubator, which relied on Maven. It uses Java for the infrastructure and Scala for HTML and many other fancy things.
I have noticed that a lot of maven imports are missing. They are somehow acknowledged by IDEA 10.0.1 Build IC-99.32, that is some things work and others don't.
- In the packages view the org.apache.clerezza... packages are only very partially listed. The screen shot below shows how many package dependencies are required in Maven, but it shows only a few in the Libraries section. It seems that only org.apache.clerezza.scripting shows up, where the maven tab in the top right pane shows clearly the following being listed
- org.apache.clerezza.rdf.core
- org.apache.clerezza.rdf.scala.utils
- org.apache.clerezza.rdf.ontologies
- org.apache.clerezza.jaxrs.utils
- org.apache.clerezza.triaxrs
- and many more
- As a result (I guess) the Scala editor has a problem finding the FOAF class even though the package in which it is to be found is declared at the top of the file
import org.apache.clerezza.rdf.ontologies._
On the other hand - oddly enough - the Scala editor recognises the package the FOAF class should be in, and asks to add the required import statement.
Attachment(s):
Maven Dependency problem.png
Please sign in to leave a comment.
I've often noticed that Maven has lots of problems figuring out (and subsequently downloading) nested dependencies.
Top level dependencies of course are listed in the POM and recognised just fine, but dependencies by these dependencies are not properly parsed from their poms, leading to compiler and/or runtime failures.
As a result, we've taken to (if we use Maven at all, I still prefer ANT for its more fine-grained control that doesn't force things upon teams) always list all dependencies (including nested ones) as top level dependencies in the main POM to ensure everything needed gets downloaded and remains of the version we desire.
Hello Henry,
is the needed Maven artifact really accessible by IDEA/Maven? A lot of these problems arises, when the <version> tag in the pom.xml is missing and you have multiple possible versions of this artifact available. Please check in the project view (View as: Project) under External Libraries the needed Maven dependency is listed as something like this:
Maven: org.apache.clerezza:org.apache.clerezza.rdf.core:VERSION
If you see none or multiple entries with different versions, you have to exclude the wrong versions out of your pom.xml.
You can check, if Maven is able to get the right dependency by the help plugin. Run this in a shell:
mvn dependency:tree -Dincludes=org.apache.clerezza
I never saw such a problem with Maven. In fact, this is one advantage (if not the only one advantage beside convention-building) of Maven against Ant. Usually the cause of these problems are misconfigured dependency sections in the pom.xml. If transitive dependencies are not downloaded, almost always it is due to a version conflict of different other dependencies or not correctly set versions. Sometimes it is because of a transitive dependency marked as optional, because there are more than one providers available.
I made the best experience with explicitly setting all versions of all dependencies. To keep life simple, use properties for this (IDEA has a nice refactoring for this, btw). After this, the most important task is to check for mutliple versions with the help-plugin, like I mentioned in my answer below. And the Maven versions plugin is useful, too.
There are no problems with Maven here. Clerezza can be built fine using Maven. This is an issue of IntelliJ not picking the dependencies up correctly. Furthermore Netbeans works for clerezza here.
There is no problem running
mvn dependency:tree -Dincludes=org.apache.clerezza
it completes successfully. The whole project also compiles successfully with this
$ export MAVEN_OPTS=-Xmx512m
More details on getting it working on this e-mail "Clerezza and WebID: How to get it going"
(note: now the shell has changed, so you need to add :f before any command)
Also recent changes have made Clerezza require somewhat more memory. I need this now
$ java -Dfile.encoding=utf-8 -Xmx512m -XX:MaxPermSize=248M -jar org.apache.clerezza.platform.launcher.sesame-0.5-incubating-SNAPSHOT.jar --https_keystore_clientauth want --https_port 8443 --https_keystore_path /Users/hjs/tmp/cert/KEYSTORE.jks --https_keystore_password secret
(The https_port and keystore path attributes should probably be dropped initially, if you have not created yourself a local key...)
it's worth trying out to see what is going on here....
Henry
I have been using Netbeans since my last post to see if the problems would get solved with a new release of IntelliJ. As I saw there was a new release of IntelliJ, I thought it would be worth trying to see how things stood now. The good news: one of my Scala problem seems to have been solved. On the other hand this maven problem remains in IntelliJ 10.0.2
I have attached two screenshots of IntelliJ with the maven tab open. Perhaps that can help spot the mistake. The first attached picture shows the following message at the top of the yellow pop up:
"Problem resolving expression ${project.groupid} ..."
But I can't see where I should set that. Also from the command line I don't need to set it.
The project is still available in the same place from svn, though the directory structure has changed recently. It can be downloaded from svn from here
$ svn co https://svn.apache.org/repos/asf/incubator/clerezza/trunk
The files are in the parent directory. Perhaps that should help to find out what IntelliJ is not picking up.
Attachment(s):
Screen shot 2011-02-17 at 23.01.39.png
Screen shot 2011-02-17 at 23.01.25.png
This seems to have been fixed in the trunk of IntelliJ Open Source. I built it following the recipe detailed on the page "Check Out & Build Community Edition"
Today is 18 Febuary 2011, btw.
This bug remains. I use IntelliJ IDEA 11.1 (117.84) and I still experience this problem.