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 249423 - Artifact uses property in artifact name - netbeans internal pom representation is unable to resolve it
Summary: Artifact uses property in artifact name - netbeans internal pom representatio...
Status: RESOLVED INCOMPLETE
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.1
Hardware: PC Mac OS X
: P1 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-18 08:29 UTC by Tomas Danek
Modified: 2015-01-09 11:32 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 Tomas Danek 2014-12-18 08:29:56 UTC
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17
System: Mac OS X version 10.10.1 running on x86_64; UTF-8; en_US (nb)
User directory: /Users/danek/Library/Application Support/NetBeans/8.0
Cache directory: /Users/danek/Library/Caches/NetBeans/8.0
--------------------------------------
- have a mvn project P, that depends on artifact A, and pom of artifact A declares dependency on other artifact B
- artifact B contains in it's name property (either defined in parent pom, or in profile)

--> NetBeans is able to resolve dependency of P on A, but not transitive dependency P on B - because parsing of A's POM fails with errors like this:

org.apache.maven.project.InvalidProjectModelException: Some problems were encountered while processing the POMs:
[ERROR] 'artifactId' with value 'foo-client_${build.scala.version}' does not match a valid id pattern. @ line 10, column 17
 for project 
	at org.apache.maven.project.DefaultMavenProjectBuilder.transformError(DefaultMavenProjectBuilder.java:193)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:240)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:258)
	at org.netbeans.modules.maven.repository.ui.ArtifactMultiViewFactory.readMavenProject(ArtifactMultiViewFactory.java:231)
	at org.netbeans.modules.maven.repository.ui.ArtifactMultiViewFactory.access$000(ArtifactMultiViewFactory.java:104)
	at org.netbeans.modules.maven.repository.ui.ArtifactMultiViewFactory$1.run(ArtifactMultiViewFactory.java:187)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

(you can view this error if you navigate to P > Dependencies > A | View Artifact Details)

- this affects code completion, editor is red, and makes whole project P unusable, which makes this P1 :-(
--> correct solution would be to try to substitute properties, based on parent, and also based on currently selected profile in IDE

P.S.: Thanks for keeping NetBeans great, first serious bug found after > 6 month using! zdravim z Avastu ;-)
Comment 1 Tomas Stupka 2015-01-09 11:32:28 UTC
could not reproduce

1 parent project "parent" with 3 modules - A, B, P
all of them declare "parent" as a parent
P has a dep on A
A has a dep on B

A/pom.xml
...
<dependency>
    <artifactId>project${b}</artifactId>
...

B/pom.xml
...
<artifactId>project${b}</artifactId>
...

P/pom.xml
<dependency>
    <artifactId>projectA</artifactId>

parent/pom.xml
...
<properties>
    <b>B</b>

am i missing something?

what version of maven do you use? 
any chance to provide a sample setup?

regarding B/pom.xml:
maven was complaining about the prop in the projects artifactId

[WARNING] Some problems were encountered while building the effective model for com.mycompany:projectB:jar:1.0-SNAPSHOT
[WARNING] 'artifactId' contains an expression but should be a constant. @ com.mycompany:project${b}:1.0-SNAPSHOT ...
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

'artifactId' contains an expression but should be a constant, but maybe that's not how you use it and you got the prop only in the dep of project A (or somewhere else?), which btw worked for me as well. 

need more info so incomplete for now, but of course, feel free to reopen ...

P.S.: the pleasure is ours ...