I have a Java codebase that was written with Eclipse that I am trying to work with in IntelliJ.
The codebase consists of about 20 Java packages built alongside each other as separate projects. (There are about twenty directories, each containing a .classpath
and .project
file.) They have dependencies on each other. Presumably everything builds just fine in Eclipse.
I had IntelliJ import these from the Eclipse build format. It mostly seemed to work except that Project Settings -> Modules -> Dependencies
shows that many projects have an unresolved dependency on org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
. This appears to come from the following entries in the .classpath
files:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
The packages with this dependency do not build in IntelliJ because they can't resolve the dependencies on the other packages.
I suspect that org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
is some Eclipse-specific trickery that doesn't translate to a different IDE, but I can't figure out exactly what is going on here.
What is org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
? Do I have to do anything special to a build environment that uses it to make it work outside Eclipse?
IntelliJ Ultimate 2016.1.2, Java 1.8.0_91, OS X 10.11.5
I worked around this problem by going into Project Settings->Modules and manually adding module dependencies between my various projects until everything built. Tedious but effective.
I'm leaving this question up here, though, because a short definition of org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
would still have been helpful to me.
If you want to check whether a dependency still exists in your project, and find its exact usages, you can run dependency analysis: From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Modules | Dependencies. Right-click the necessary dependency and select Analyze This Dependency.
The IntelliJ IDEA Maven-2 plugin integrates Maven-2 into IntelliJ IDEA.
First,
Second,
Third,
Similar to the Ant plugin, the Maven-2 plugin allows execution of goals (or phases) and redirects output (with error highlighting) to the message window.
Available for IDEA 6.0 (until version 1.1 also for IDEA 5.0) through IDEAs built-in plugin manager or directly from {{http://plugins.intellij.net/plugin/?id=1166}}.
In case you downloaded the plugin, simply extract the content of the binary archive into your IDEA plugin directory. The extracted folder (idea-maven-plugin) contains another folder lib, where all the JARs reside.
Assuming you have specified the environment variables JAVA_HOME and M2_HOME the plugin should be ready to run without any further configuration. In case JAVA_HOME is not defined, the plugin uses the internal IDEA JDK.
If M2_HOME is not defined, you must specify the home directory of Maven-2 in the configuration dialogs. This is a change starting from version 1.1 of the plugin.
Before version 1.1, Maven was called via the start script provided with the normal Maven installation. In order to get better access to the running Maven process Maven now is called directly by starting a Java process. This for example allows terminating the running Maven process by the user.
The configuration can be done in two ways:
Either via the IDE Settings or the Project Settings. The project settings always override the application settings!
The plugin will not work with IDEA versions prior to 6.0! The plugin was tested under Windows and Linux. It was not tested under Mac OS X.
I've come up with a solution that works for me, but the bounty is still open (because I can't close it :P ) and will go to someone who can provide a more detailed explanation.
The solution: Run mvn eclipse:clean
and mvn eclipse:eclipse
. This causes maven to clear the .classpath file and rebuild it from the pom.xml. Somewhat mysteriously, it no longer contained the dreaded reference to org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
.
Perhaps this is a deprecated tag/variable in Eclipse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With