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 213175 - ProjectClassPathModifier.removeAntArtifacts does not remove artifacts from build-impl.xml and project.xml
Summary: ProjectClassPathModifier.removeAntArtifacts does not remove artifacts from bu...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks: 212452
  Show dependency tree
 
Reported: 2012-05-29 15:33 UTC by Petr Somol
Modified: 2012-06-02 06:09 UTC (History)
1 user (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 Petr Somol 2012-05-29 15:33:30 UTC
In JavaFX Preloader support I need to programmatically add and remove dependence between NB projects. For this purpose I use ProjectClassPathModifier.addAntArtifacts and ProjectClassPathModifier.removeAntArtifacts methods, which I expect should provide complementary operations, i.e., after a call to addAntArtifacts followed by removeAntArtifacts with the same set of parameters I would expect the project to get back to the same state as before the calls. However, this seems not to be the case.

The call to addAntArtifacts adds to build-impl.xml:

<antcall target="-maybe-call-dep">
  <param name="call.built.properties" value="${built-jar.properties}"/>
  <param location="${project.JavaFXPreloader24}" name="call.subproject"/>
  <param location="${project.JavaFXPreloader24}/build.xml" name="call.script"/>
  <param name="call.target" value="jar"/>
  <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
</antcall>

and a similar code for call.target clean. To project.xml it adds

<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
  <reference>
    <foreign-project>JavaFXPreloader24</foreign-project>
    <artifact-type>jar</artifact-type>
    <script>build.xml</script>
    <target>jar</target>
    <clean-target>clean</clean-target>
    <id>jar</id>
  </reference>
</references>

In Projects window in the IDE it can be seen that the dependence has been added; it is listed under project's Libraries.

Then, the call to removeAntArtifacts with the same parameters seems to work from what is seen in the IDE (the dependence vanishes from Libraries in Projects panel), but build-impl.xml and project.xml remains untouched. The project then still can be built, and build messages show that the dependent project is built as well, what is incorrect. The project then fails to run due to the leftover dependence with

java.lang.ClassNotFoundException: javafxpreloader24.JavaFXPreloader24
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at com.javafx.main.Main.getAppClass(Main.java:442)
	at com.javafx.main.Main.launchApp(Main.java:466)
	at com.javafx.main.Main.main(Main.java:638)
Java Result: 1

Am I right this is a bug in ProjectClassPathModifier or do I miss something here ?
Comment 1 Petr Somol 2012-05-31 13:37:47 UTC
Just remarking that a similar problem seems to be there for
ProjectClassPathModifier.addRoots() and removeRoots().
I use these to add dependency on a preloader jar for which there is no NB project. The call to addRoots() adds the property

file.reference.FILENAME.jar=path to FILENAME.jar

but after the call to removeRoots() this property remains in project.properties.
Comment 2 Tomas Zezula 2012-05-31 16:59:42 UTC
Fixed jet-main 9da1c4b0c4b9
Comment 3 Quality Engineering 2012-06-02 06:09:51 UTC
Integrated into 'main-golden', will be available in build *201206020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/9da1c4b0c4b9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #213175:ProjectClassPathModifier.removeAntArtifacts does not remove artifacts from build-impl.xml and project.xml