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.
1. wrong property name is created when referenced project contains spaces in name 2. the same reference name is used for two different ant articats of the same referenced project 3. relative JAR path is not URL-decoded ex: libs.classpath=${reference.My Project.jar-all};${reference.My Project.jar-all} reference.My\ Project.jar-all=${project.My Project}/dist/Nokia/My%20Project.jar
Assigning to David for now. Re. #1 - yes RH is supposed to replace dangerous chars with '-' or '_' or something. Re. #2 - not sure about it. Re. #3 - should not be using URL encodings in property values since Ant does not interpret them. Probably a bug in PropertyUtils.relativize. Is there a reason why this is filed as P1? Is this blocking some kind of work for you? If not, it is P2.
OK, changed to P2, sorry. ad #2: reference is constructed from project name and target but different jar taken is not mentioned ex.: one J2ME project can have multiple configurations, all of them are build by jar-all target but jars are located at different folders. libs.classpath=${reference.My Project.jar-all};${reference.My Project.jar-all} - references twice the same reference.My\ Project.jar-all=${project.My Project}/dist/Nokia/My%20Project.jar - but this is the only one of referenced artifacts
I will fix #1 and #3. As for the #2: this is caused by your configurations about which ReferenceHelper does not know nothing. Please look at it and suggest some solution/patch how you think the ReferenceHelper should be modified to be still usable for you. The very stupid solution I can imagine is that you use ReferenceHelper as is and after it generates the property you read the value and store it as <configuration>.reference=reference_value or something like. I do not remember details how your configurations are implemented. There are certainly other solutions. Also take a look at org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport which you might need to use too. See issue 42520 for more details.
ad #2 reference name just need to be uniqe. There is no problem with configurations of current project but with the referenced one. Problem is that two Ant articats can differ only in URI getArtifactLocation().
Two AntArtifact's *cannot* differ only in artifact location; they must be using a different target. The primary key is [project,targetName]. Clean target name, type, and artifact location are non-key data. So if ReferenceHelper creates properties of the form reference.<uniq-project-name>.<target-name> then it is behaving correctly.
Jesse, in that case we should update Javadoc for AntArtifactProvider.getBuildArtifacts() to say that. Here are two thoughts on how this could be fixed: The ReferenceResolver could be modified to take in account also the artefact location. That is, for two same AA with different artefact location it would generate one ID for project ("project.<FOREIGN_PROJ>") and two IDs for file references ("reference.<FOREIGN_PROJ>.jar" and "reference.<FOREIGN_PROJ>.jar-2"). I think it is doable. The RH.removeReference(projName, targetName) must be updated and perhaps some other methods too. But this change kills one feature: if user changes output path in project A and the project is used from project B then we cannot automatically update reference value in project B to point to new filename. That's bad. Improvement of previous solution could be: enhance AA with new method: /** * Returns identifier of the AntArtifact which must be UNIQUE WITHIN * ONE PROJECT. By default it is target name which produces the * artefact, but if your target produces more that one artefact then * you must override this method and uniquely identify each artefact. */ public String getID() { return getTargetName(); } The method would be overriden in J2ME and would return e.g.: (getTargetName() + "-" + getConfigurationID()). RH would be modified to use this ID.
Second solution sounds acceptable.
Created attachment 14831 [details] API change diff
Attached is diff with changes. Unfortunately there is couple of API changes and not all are compatible: * AntArtifactQuery.findArtifactByTarget() renamed to findArtifactByID(). I could leave there findArtifactByTarget() but its return value would have to be changed to array anyway. So I just removed it. * second parameter of ReferenceHelper.removeReference() and removeRawReference() is still of type String but now it is ID and not target name anymore * ReferenceHelper.RawReference constructor has one more parametr: ID. I considered to provide backward compatible constructor using target name as ID, but I think it is better to break potential code in Web or J2ME and point them to the change * old project with persisted references to some other project will be broken now: IllegalArgumentException will be thrown because persisted artifact in project.xml does not store ID. Again, could be tolerated for some time, but we do not have commitment to project format so I think it is better to break it now then later. If you find these changes OK I will commit it and post note on nbdev.
Sounds OK to me. Don't forget about #1 and #3 - should probably be filed separately.
#1 - filed as issue 43190 #3 - files as issue 43191
Adam, please verify. Thanx. Fixed in: Checking in src/org/netbeans/api/project/ant/AntArtifact.java; new revision: 1.8; previous revision: 1.7 Checking in src/org/netbeans/api/project/ant/AntArtifactQuery.java; new revision: 1.4; previous revision: 1.3 Checking in src/org/netbeans/spi/project/ant/AntArtifactProvider.java; new revision: 1.4; previous revision: 1.3 Checking in src/org/netbeans/spi/project/support/ant/ReferenceHelper.java; new revision: 1.8; previous revision: 1.7 Checking in test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java; new revision: 1.8; previous revision: 1.7