I have a project (pom.xml) that behaves different from IntelliJ with my command line Maven 2.0.9. I want to know what is the Maven Version built into IntelliJ 8.1.
I have a project (pom.xml) that behaves different from IntelliJ with my command line Maven 2.0.9. I want to know what is the Maven Version built into IntelliJ 8.1.
IntelliJ IDEA uses the Maven embedder, which is only available as part of Maven 2.1 development branch. So its behavior is not necessarily an exact match for a particular version of Maven 2.0.x.
-- Dmitry Jemerov Development Lead JetBrains, Inc. http://www.jetbrains.com/ "Develop with Pleasure!"
IntelliJ IDEA uses the Maven embedder, which is only available as part of Maven 2.1 development branch. So its behavior is not necessarily an exact match for a particular version of Maven 2.0.x.
I can build my application with standalone Maven 2.1.0-M1 or 2.0.9 using JDK 1.5 (OS X Leopard). The same multi module pom.xml, executed under Intellij 8.1 embedded Maven, will generate many error messages (please refer to the output in the attachment). I have a parent pom with 1 war (apps-xchg) module and 7 jar modules. I have included the output file and hopefully it provides some leads to what is going on.
Please try disabling automatic folders update on import on Settings->Maven->Importing page. This option disables automatic source generation in orfer for IDEA to discover custom source folders generated by plugins. If you don't have such, you may safely disable this option. If you have, you can manually setup the source folders.
In the next eap will be available an option to select a phase to run during this task, with such an option you will be able to configure it according to your particular configuration.
No good. Disabling automatic folders update on import does not help. Guess I just wait for EAP.I will stick with 8.01
FYI, in 8.1, in addition to the problems I mentioned, the classpath was screwed up too. Intellij can't locate any class, not even java.lang.String. For 8.01, the classpath was alright. I only had issues with embedded Maven.
Lim, Disabling auto-folders update should solve the problem during the import. Maven goals are run with an external Maven, not the embedded. What is the problem with classpaths?
Yes. My mistake. Target uses external Maven. Touching on external Maven, I find that in OS X, M2_HOME variable is not honored and therefore I had to explicitly set Maven directory in Settings.
Basicaly, all library classes are not found, not even java.lang.String (refer to attachment) but it is alright with v8.01.
I have attached a sample Maven project to show the error. I found the "error" lies in 1 of the the dependencies inside the file parent-myapp/pom.xml. Core classes like java.lang.String not found in v8.1 while v8.0.1 is fine.
I use Ubuntu 8.04 (will upgrade to 9.04 as soon as the release is official) and IDEA-8.1 (build 9732). I typically set all my environment variables in my $HOME/.profile include M2_HOME. Environment variables can also be set by entering ctrl-alt-s and then selecting 'Path Variables' in the IDE Settings panel on the left and then clicking the Add button. By the way, I've also given more resources to Maven by adding another environment variable in my $HOME/.profile - export MAVEN_OPTS="-Xms128m -Xmx512m"
This will be different if you're using Windows or another shell (my default shell is bash).
IDEA always updates the folders according to the pom structure. It aslo tryes to discover additional folders provided by plugins by generating sources if this option is enabled.
You don't you want IDEA to update the folders for you?
Absolutlly not!!! Please tell me how to avoid IDEA ignoring my settings & automatically changing the source folders from target/generated-sources(my setting) to target/generated-sources/com,target/generated-sources/org,target/generated-sources/xjc? I've tried uncheck the option but useless. This feature drives my mad.
It is a standard convention that all generated sources are places into target/generated-sources/<subfolder>. Please change your pom files so that the corresponding plugin put the files under a subfolder in the generatoed-sources directory and IDEA will automatically pick up them.
<plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> .... <configuration> ... <generateDirectory>target/generated-sources</generateDirectory> <!-- change the value totarget/generated-sources/jaxb (or to your taste) -->
Have you encountered any problem with the fakeacme.zip project I posted a while back? Did the error I mention manifest in your Intellij 8.1 installation?
I've tried the project and couldn't see any problem with JDK classes. Please check that your project JDK is configured correctly and all modules inherit or set the correct JDK.
If you are sure the configuration is correct, please try clearing system caches (File->Invalidate Caches action).
Hi, Lim,
IDEA uses special Maven Embedder that is still under development.
Could you descripe the inconsistencies you've experienced?
Thanks,
Atnon Makeev
Hello TH,
IntelliJ IDEA uses the Maven embedder, which is only available as part of
Maven 2.1 development branch. So its behavior is not necessarily an exact
match for a particular version of Maven 2.0.x.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
So, this could be the cause for my problem:InvocationTargetException when re-importing a mavenized grails app?
I can build my application with standalone Maven 2.1.0-M1 or 2.0.9 using JDK 1.5 (OS X Leopard). The same multi module pom.xml, executed under Intellij 8.1 embedded Maven, will generate many error messages (please refer to the output in the attachment). I have a parent pom with 1 war (apps-xchg) module and 7 jar modules. I have included the output file and hopefully it provides some leads to what is going on.
Thanks
Attachment(s):
mvn_output.txt.gz
Please try disabling automatic folders update on import on Settings->Maven->Importing page. This option disables automatic source generation in orfer for IDEA to discover custom source folders generated by plugins. If you don't have such, you may safely disable this option. If you have, you can manually setup the source folders.
In the next eap will be available an option to select a phase to run during this task, with such an option you will be able to configure it according to your particular configuration.
Thanks,
Anton Makeev
No good. Disabling automatic folders update on import does not help. Guess I just wait for EAP.I will stick with 8.01
FYI, in 8.1, in addition to the problems I mentioned, the classpath was screwed up too. Intellij can't locate any class, not even java.lang.String. For 8.01, the classpath was alright. I only had issues with embedded Maven.
Thanks
/lim/
Lim,
Disabling auto-folders update should solve the problem during the import. Maven goals are run with an external Maven, not the embedded.
What is the problem with classpaths?
Yes. My mistake. Target uses external Maven. Touching on external Maven, I find that in OS X, M2_HOME variable is not honored and therefore I had to explicitly set Maven directory in Settings.
Basicaly, all library classes are not found, not even java.lang.String (refer to attachment) but it is alright with v8.01.
Thanks
/lim/
Attachment(s):
Picture 1.png
Please check if your JDK is set up correctily.
Thanks,
Anton Makeev
Yes. Checked twice.
Btw, any solution to this as why M2_HOME variable is not honored in OS X? M2_HOME should be defined in ~/.MacOSX/environment.plist
Thanks
Please attch a sample project then.
Thanks,
Anton Makeev
I have attached a sample Maven project to show the error. I found the "error" lies in 1 of the the dependencies inside the file parent-myapp/pom.xml. Core classes like java.lang.String not found in v8.1 while v8.0.1 is fine.
Thanks
/lim/
Uploaded a newer fakeacme.zip
Attachment(s):
fakeacme.zip
I use Ubuntu 8.04 (will upgrade to 9.04 as soon as the release is official) and IDEA-8.1 (build 9732). I typically set all my environment variables in my $HOME/.profile include M2_HOME. Environment variables can also be set by entering ctrl-alt-s and then selecting 'Path Variables' in the IDE Settings panel on the left and then clicking the Add button. By the way, I've also given more resources to Maven by adding another environment variable in my $HOME/.profile -
export MAVEN_OPTS="-Xms128m -Xmx512m"
This will be different if you're using Windows or another shell (my default shell is bash).
I've disabled the automatically generate sources option but IDEA still changes my source folders while importing, why?
Hi,
IDEA always updates the folders according to the pom structure.
It aslo tryes to discover additional folders provided by plugins by generating sources if this option is enabled.
You don't you want IDEA to update the folders for you?
Thanks,
Anton Makeev
Absolutlly not!!! Please tell me how to avoid IDEA ignoring my settings & automatically changing the source folders from target/generated-sources(my setting) to target/generated-sources/com,target/generated-sources/org,target/generated-sources/xjc? I've tried uncheck the option but useless. This feature drives my mad.
It is a standard convention that all generated sources are places into target/generated-sources/<subfolder>.
Please change your pom files so that the corresponding plugin put the files under a subfolder in the generatoed-sources directory and IDEA will automatically pick up them.
Thanks,
Anton Makeev
my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa</groupId>
<artifactId>com-vo</artifactId>
<packaging>jar</packaging>
<version>1.1-SNAPSHOT</version>
<name>com-vo</name>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:svn:http://svn.aaa.com/svn/com-vo/trunk</connection>
<developerConnection>scm:svn:http://svn.aaa.com/svn/com-vo/trunk</developerConnection>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>com-vo</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<bindingDirectory>src/main/resources/binding</bindingDirectory>
<bindingIncludes>
<include>*.xjb</include>
</bindingIncludes>
<schemaDirectory>src/main/resources/schema</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<generateDirectory>target/generated-sources</generateDirectory>
<removeOldOutput>false</removeOldOutput>
<extension>true</extension>
<strict>true</strict>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>aaa-repo</id>
<url>http://sun.aaa.com/maven</url>
</repository>
<repository>
<id>aaa-repo-snapshot</id>
<url>http://sun.aaa.com/maven-snapshot</url>
</repository>
<repository>
<id>java.net</id>
<name>java.net Maven Repository</name>
<url>https://maven-repository.dev.java.net/nonav/repository</url>
<layout>legacy</layout>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots />
<id>Maven Snapshots</id>
<url>http://snapshots.maven.codehaus.org/maven2/</url>
</pluginRepository>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<inputEncoding>utf-8</inputEncoding>
<outputEncoding>utf-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<distributionManagement>
<repository>
<id>aaa-repo</id>
<url>scp://sun.aaa.com:/usr/local/apache2/htdocs/maven/</url>
</repository>
<snapshotRepository>
<id>aaa-repo-snapshot</id>
<name>aaa Maven Snapshot Repository</name>
<url>scp://sun.aaa.com:/usr/local/apache2/htdocs/maven-snapshot</url>
</snapshotRepository>
<site>
<id>aaa-site</id>
<name>business api website</name>
<url>scp://sun.aaa.com:/var/www/localhost/htdocs/projects/com-vo</url>
</site>
</distributionManagement>
</project>
Does this file have some config error? Can't I just lock my source folders setting?
Simply change the configuration of the plugin:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
....
<configuration>
...
<generateDirectory>target/generated-sources</generateDirectory> <!-- change the value to target/generated-sources/jaxb (or to your taste) -->
....
</configuration>
</plugin>
Thanks,
Anton Makeev
Anton,
Have you encountered any problem with the fakeacme.zip project I posted a while back? Did the error I mention manifest in your Intellij 8.1 installation?
Thanks.
I've found the solution at _https://maven-jaxb2-plugin.dev.java.net/docs/guide.html, thank you very much.
Hi, Lim,
I've tried the project and couldn't see any problem with JDK classes.
Please check that your project JDK is configured correctly and all modules inherit or set the correct JDK.
If you are sure the configuration is correct, please try clearing system caches (File->Invalidate Caches action).
Thanks,
Anton Makeev
Clearing system caches (File->Invalidate Caches action) helps. Probably my IDE was plagued by stale files.