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.

Bug 237827 - Variable substitutions not recognized in maven-compiler-plugin source value
Summary: Variable substitutions not recognized in maven-compiler-plugin source value
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 237856
Blocks:
  Show dependency tree
 
Reported: 2013-10-30 20:11 UTC by Jesse Glick
Modified: 2013-11-28 02:43 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2013-10-30 20:11:47 UTC
7.4 FCS. I have a plugin whose parent POM defines

  <properties>
    <java.version>5</java.version>
  </properties>
…
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.${java.version}</source>
          <target>1.${java.version}</target>
        </configuration>
      </plugin>

which is understood by Maven but the IDE shows no selection in File » Project Properties » Sources » Source/Binary Format, and prompts me to use the JDK 7 diamond operator etc. when such constructs would not compile.

So probably the SourceLevelQuery implementation is failing to use the Maven property evaluator?
Comment 1 Milos Kleint 2013-10-31 08:13:56 UTC
I think the problem is in the java.version expression specifically. renaming to java2.version fixes the problem.

java.version is likely defined in getJavaPlatform().getSystemProperties() and NBPluginParameterExpressionEvaluator attempts to evaluate these first before the content of the MavenProject.getProperties()

will need to sync the NBPluginParameterExpressionEvaluator class with what maven itself is doing.

BTW this also means that effective-pom tab shows the wrong value.
Comment 2 Milos Kleint 2013-10-31 12:38:43 UTC
well, it appears we've never properly distinguished between user and system level properties.

http://hg.netbeans.org/core-main/rev/1ef858a2ecb9
Comment 3 Jesse Glick 2013-10-31 16:12:04 UTC
Ahh, did not even think of that. Thanks, confirmed that this is the workaround in 7.4 (in my case changing the parent POM to use a different property name is no problem).
Comment 4 Milos Kleint 2013-10-31 16:16:37 UTC
(In reply to Jesse Glick from comment #3)
> Ahh, did not even think of that. Thanks, confirmed that this is the
> workaround in 7.4 (in my case changing the parent POM to use a different
> property name is no problem).

When I found the root cause, I was pretty amazed that we could get away with it for so long (it was there since day one I think)
Comment 5 Milos Kleint 2013-11-01 07:25:03 UTC
and one more change needed
http://hg.netbeans.org/core-main/rev/317039901ede
Comment 6 Antonin Nebuzelsky 2013-11-01 13:03:36 UTC
Jesse, can you help verify the fix? We'd include it in patch 1 then.
Comment 7 Jesse Glick 2013-11-01 15:32:59 UTC
Remind me when it shows up in main-silver (or actually releases). Recently I have been running 7.4 rather than dev builds due to horrible problems with the editor.
Comment 8 Quality Engineering 2013-11-02 11:45:06 UTC
Integrated into 'main-silver', will be available in build *201311020744* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1ef858a2ecb9
User: Milos Kleint <mkleint@netbeans.org>
Log: #237827 split system and user properties when loading projects
Comment 9 Tomas Danek 2013-11-08 12:25:04 UTC
Verified in Dev 201311080001;

(system) properties are substituted correctly, if defined in parent, and also if not defined and this considered as system ones.
Comment 10 Milos Kleint 2013-11-08 13:09:06 UTC
(In reply to Tomas Danek from comment #9)
> Verified in Dev 201311080001;
> 
> (system) properties are substituted correctly, if defined in parent, and
> also if not defined and this considered as system ones.

user properties are what user adds on the cmd line, in your case that would be in configuration definition.
system properties is stuff coming from System.getProperty() basically, stuff that is inherent to java platform etc..
Comment 11 Milos Kleint 2013-11-13 09:49:29 UTC
http://hg.netbeans.org/releases/rev/fd20328b127c
Comment 12 Quality Engineering 2013-11-14 14:31:26 UTC
Integrated into 'releases/release74', will be available in build *201311141216* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/fd20328b127c
User: Milos Kleint <mkleint@netbeans.org>
Log: #237827 split system and user properties when loading projects
Comment 13 Tomas Danek 2013-11-22 13:21:05 UTC
verified in 74patch1

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 1
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Mac OS X version 10.9 running on x86_64; UTF-8; en_US (nb)
User directory: /Users/tomas/Library/Application Support/NetBeans/7.4
Cache directory: /Users/tomas/Library/Caches/NetBeans/7.4
Comment 14 Quality Engineering 2013-11-28 02:43:52 UTC
Integrated into 'main-silver', will be available in build *201311280002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/ea1948ae5ee2
User: Milos Kleint <mkleint@netbeans.org>
Log: #238800 mavenExecutionRequest.setUserProperties() was set in MavenEmbedder, but later as a consequence of #237827 reset in MavenProjectCache, now we simplify the flow for system properties and make sure the user properties get merged, not replaced