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 257891 - AutomaticExtraClasspathProvider does not work anymore in NB81
Summary: AutomaticExtraClasspathProvider does not work anymore in NB81
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 8.1
Hardware: PC Linux
: P1 normal with 2 votes (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-08 13:56 UTC by scanti
Modified: 2016-07-20 14:51 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Small example (22.39 KB, application/zip)
2016-02-08 13:56 UTC, scanti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description scanti 2016-02-08 13:56:39 UTC
Created attachment 158414 [details]
Small example

We are porting our application from NetBeans Platform 7.4 to 8.1. 
We use Jython inside Ant Scripts and we need it to access the classes inside  our modules. 

In NB7.4 this was achieved extending the Ant ClassPath via this XML text inside the layer.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
    <folder name="Services">
        <folder name="Hidden">
            <file name="module8-antlibrary.instance">
                <attr name="SystemFileSystem.localizingBundle" stringvalue="com.streamsim.geomodel.Bundle"/>
                <attr name="instanceCreate" methodvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspath.url"/>
                <attr name="url" urlvalue="nbinst://module8/modules/module8.jar"/>
                <attr name="instanceOf" stringvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspathProvider"/>
            </file>
        </folder>
    </folder>
</filesystem>

Unfortunately this does NOT work anymore in NB81; I tried the @ServiceLocator but it throws exception about the same class loaded by two different ClassLoaders.

I made a small example, if you run it on NB74, you will see module8.jar in the ClassPath, if you run it on NB81, you won't .

Thanks
Comment 1 scanti 2016-02-08 16:43:21 UTC
Sorry I am rising to P1 because this is totally blocking our release of the application.
Comment 2 Tomas Stupka 2016-07-20 14:51:58 UTC
The purpose of AutomaticExtraClasspathProvider is to set the classpath for the executed ant tasks loader and the java system property java.class.path should not be touched by the ant execution. It was set merely as a workaround for issue #46171 and that behavior was removed because it became obsolete, caused other problems (issue #251501), and eventually could cause more problems in the future.

that AECP is still working as expected can be checked in your sample by creating some class in module8 and by extending the script generated in .runMe() with something like:
wr.write("<available classname=\"module8.SomeClass\" property=\"class.present\"/>\n");
wr.write("<echo message=\"${class.present}\" />\n");