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 227821 - Application compilation failed if current project's parent version is an expression.
Summary: Application compilation failed if current project's parent version is an expr...
Status: RESOLVED INCOMPLETE
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3
Hardware: PC Linux
: P1 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-22 13:24 UTC by sgguo
Modified: 2013-03-25 06:01 UTC (History)
0 users

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 sgguo 2013-03-22 13:24:05 UTC
1. create a top level maven project and set its version to one property. E.g.
   <groupId>com.example</groupId>
   <artifactId>test</artifactId>
   <packaging>pom</packaging>
   <version>${test.version}</version>
   ...
   <properties>
       <test.version>0.1</test.version>
   </properties>
   ...
2. create a maven project and set it as a child of above project. E.g.
   <parent>
      <artifactId>test</artifactId>
      <groupId>com.example</groupId>
      <version>${test.version}</version>
   </parent>
   <groupId>com.example</groupId>
   <artifactId>testchild1</artifactId>
   <packaging>pom</packaging>
   
   <modules>
      <module>onlyfortest<module>
   <moudles>
   
3. make the module "onlyfortest" in 2 as a child of pom file in 2, and it is a java project which can package a jar file. The issue here is when I try to debug this project, what I get is below error:

Failed to execute goal on project "onlyfortest": Could not resolve dependencies for project com.example:onlyfortest:jar:0.1: Failed to collect dependencies for [Could not transfer artifact com.example:test:pom:${test.version} 
...
IllegalArgumentException: ... test/${test.version}/test-${test.version}.pom -> [Help 1]

Two concerns here:
1. I already compiled this project before debug, why need to compile again.
2. If compile again, can we use the true version number "0.1" instead of "test.version" here?
Comment 1 Milos Kleint 2013-03-22 13:28:56 UTC
so your command line maven build failed? 

expressions in <version> or <parent>/<version> are discouraged in maven 3.x I believe..
Comment 2 sgguo 2013-03-22 14:04:14 UTC
Yes, the build failed, I get the error message in netbeans console window. I know maven doesn't encourage we use expressions in <version> or parent version. Do you have any suggestion for us to make the version unique in a big project and it should be easy to change?

If so, it means this bug will not be fixed in Netbeans, in fact, as I know, currently many maven project still use the expressions in version.
(In reply to comment #1)
> so your command line maven build failed? 
> 
> expressions in <version> or <parent>/<version> are discouraged in maven 3.x I
> believe..
Comment 3 Milos Kleint 2013-03-22 14:21:59 UTC
I'm not really sure what is expected from me here. If your command line build fails, it's unrelated to netbeans. if your build doesn't fail with an old version of maven, go to tools/options and change the maven binary to use it for execution.

if project loading fails, there's nothing I can do for you, we load projects with embedded maven3 and there's no way for us to use older version.
Comment 4 sgguo 2013-03-25 01:25:31 UTC
I need to clarify what I said in my previous comment, the maven command line failed only when netbeans call it, in another words, I only see the maven command line failed in Netbeans console window, if I run the maven command "mvn package" in terminal in Ubuntu, it works well. At the same time, I can import related project to Eclipse, no build error occurred when I debug it. so I guess it should be a netbeans issue, so I report this bug.

I change the status to "INCOMPLETE" to make sure you can give it a look. Of course, you can change it to "INVALID" if you you think it is not a bug, at least, Eclipse can be as a backup.

(In reply to comment #3)
> I'm not really sure what is expected from me here. If your command line build
> fails, it's unrelated to netbeans. if your build doesn't fail with an old
> version of maven, go to tools/options and change the maven binary to use it for
> execution.
> 
> if project loading fails, there's nothing I can do for you, we load projects
> with embedded maven3 and there's no way for us to use older version.
Comment 5 Milos Kleint 2013-03-25 06:01:41 UTC
I will need more information from you then. what maven is netbeans using? (see Tools/Options) If you set it to 2.x version does it improve things?
 can you provide the build output in netbeans and attach it to the issue? (including the initial few lines provided by netbeans)
can you provide a sample project that fails in the same way?

after you answer the qestions, please reopen the issue