This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Maven2 projects can't specify Java Platform | ||
---|---|---|---|
Product: | projects | Reporter: | henriklynggaard <henriklynggaard> |
Component: | Maven | Assignee: | David Simonek <dsimonek> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | athompson, hlavki, juhrik |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
henriklynggaard
2007-05-28 17:09:31 UTC
maven itself will always be executed by the IDE's JVM because it's embedded and executed within the same JVM. Having external execution of maven is a possible workaround, however that one has it's own set of problems (like poorer parsing of output etc). It could be implemented in the future, but not in the immediate plans for 6.0. Selecting a JDK to use with a project shall always just influence the configuration of various plugins used by the build. Eg. compiler, surefire, pmd... There is currently no support in maven to have a different JDK used for plugins in a unified manner. A maven 2.1 feature called "toolchains" shall address that issue. Then the IDE integration will plug into that system. Until then there are no plans to solve the issue on netbeans side only. Consider tweaking the affected plugin's configuration (if possible). this maven 2.1 feature is closely related http://jira.codehaus.org/browse/MNG-468 as a workaround for 6.0 I introduced this mechanism: the IDE will look for the "netbeans.hint.jdkPlatform" property in the resolved POM. The value contains the name of the java platform to use with the project(s). The format is the same as the "platform.active" property in Ant-based projects. (Easiest way to figure out the name is to create a sample j2se project, change it's platform and look for the property in nbproject/project.properties file) If the property is found and matches existing java platform, that one is used, if not the default platform is used as fallback. The proeprty can be in the project's pom.xml, any of the parent poms or also in the profiles.xml file within profile named "netbeans-private". The last option has the advantage of not polluting your version control shareable pom.xml with private IDE content. works in 6.0 beta2 or the daily builds starting with number #194 http://deadlock.netbeans.org/hudson/job/mevenide *** Issue 117097 has been marked as a duplicate of this issue. *** Thanks a lot, the workaround is working fine. works ok here as well for the editor, although i still have to compile with external Maven. why not use the existing 'project.build.plugins.configuration.target' as the hint and match it to the first platform that meets the target exactly, or fall back to the default? that way, people would only need to specify the 'netbeans.hint.jdkPlatform' hint to disambiguate between multiple JDKs with the same target level, which is probably relatively rare. people who use the hint are aware of the fact that they are using a given jdk in the IDE. The automated setting based on target/source can cause "magic" behaviour when something seems to work in the IDE's editor, but doesn't compile and vice versa without any visual clues about what is happening oh, that makes sense. the netbeans.hint.jdkPlatform property is now used to set the JAVA_HOME environment property when building with external command line maven. That should ensure the right jdk is used for compilation. The command line builds are now the default and the embedded builds are only a fallback for cases when no maven home is set in Tools/Options or no maven executable is on PATH. However the said procedure might not work on MacOSX, see http://jira.codehaus.org/browse/MNG-3707 *** Issue 148916 has been marked as a duplicate of this issue. *** *** Issue 149615 has been marked as a duplicate of this issue. *** I think there should be selector for the JRE used for maven in the global options and in the project's option. ui to be implemented for the current jdk approach in 7.0. any alternate setups (eg. maven toolchains - MNG-468) might get in once mainstream. replanning to 7.0 M2 *** Issue 154490 has been marked as a duplicate of this issue. *** Working on it... UI for specifying Java platform is done hopefully. In Project properties of Maven projects, in Compile section, there is new UI similar to Ant projects. Additionally, user is warned if external Maven is not set. w00t! Integrated into 'main-golden', will be available in build *200901070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/532dd5325ee1 User: Dafe Simonek <dsimonek@netbeans.org> Log: #104974: Initial implementation of Java Platform selection from UI |