[ http://jira.codehaus.org/browse/MCOMPILER-125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=217545#action_217545 ]
redstun commented on MCOMPILER-125: ----------------------------------- As the issue reporter, I'd like to add a note. I'm not saying it's unnecessary to have specified source/target levels. On the contrary, this is very necessary or a must. Just that, the source/target levels should be decided by its owners/developers, NOT BY Maven. It's the project owner/developer's responsibility to decided the expected source/target levels and set the values in the project POM. Thus to have reproducible builds across computers/jdks. There has been a similar issue about how to handle the resource encoding in Maven, which had also gone through a lot of discussions. It finally become clear that there should be a place in project POM to let the project owner/developers configure the desired project level source encoding, instead of allowing each Maven plugin to have its own default encoding. We can learn from the conclusion there. For this please refer to http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding Thanks > Maven should not set default Java source target level > ----------------------------------------------------- > > Key: MCOMPILER-125 > URL: http://jira.codehaus.org/browse/MCOMPILER-125 > Project: Maven 2.x Compiler Plugin > Issue Type: Improvement > Affects Versions: 2.0, 2.0.1, 2.0.2, 2.1, 2.2 > Reporter: redstun > > Expectation: > The Maven Compiler Plugin, as it is just a wrapper of the underlying > compiler (javac by default), should not change the default source/target > levels of the underlying compiler, or specifying any hard coded values, FOR > the user. > Fact: > As described in the plugin homepage > (http://maven.apache.org/plugins/maven-compiler-plugin/index.html), "The > default source setting is 1.3 and the default target setting is 1.1, > independently of the JDK you run Maven with." > And people have been complaining against this, For that the default > source/target levels are either inappropriate or outdated. See MCOMPILER-80, > MCOMPILER-46, MCOMPILER-124. Plus that MCOMPILER-80 has been re-opened > recently soon after it's fixed. > Up to now, the filed issues are all about to change the default > source/target levels to more 'current' values, but whatever the values are > set to, they will sooner or later fall out of date, this is why we have > several requests like this over time, as listed above. They all represent a > resolution for 'now', not for all the time. > On the contrary, Ant is doing this as expected, As in > http://ant.apache.org/manual/CoreTasks/javac.html, it always defaults the > source/target levels to the javac in use, and clarifies that the users are > "highly recommended to always specify them". > And As a result, Ant never gets complaints regarding the issues we filed > against Maven Compiler Plugin. > Additionally, Eclipse is using the default values from the JDK in use as > well. if we create a project with mvn archetype:generate, then mvn > eclipse:eclipse and import it into Eclipse, you'll see that Eclipse does it > like Ant. Keep the project open in Eclipse and do a mvn compile outside (or > phases that depend on it, such as mvn package), you'll see a weird compile > error in Eclipse with no obvious clue. At the beginning you won't 'see' that > the problem is caused by Maven, to be specific, the source/target levels set > by Maven FOR you. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira