Community
Participate
Working Groups
The operation "Create feature JAR" generates build.xml's in plugins directories with missing runtime libraries which are reexported through more than 2 plugins. EXAMPLE: samplePluginA lib/a.jar (exported) samplePluginB (depends on samplePluginA, dep. reexported) lib/b.jar (exported) samplePluginC (depends on samplePluginB, dep. reexported) samplePluginD (depends on samplePluginC, dep. reexported) sampleFeature (contains plugins A,B,C,D) The action "Create Feature JAR" generates build.xml in pluginD with the following contents: <target name="samplePluginD.jar" depends="init" unless="samplePluginD.jar"> <property name="destdir" value="${temp.folder}/samplePluginD.jar.bin"/> <delete dir="${temp.folder}/samplePluginD.jar.bin"/> <mkdir dir="${temp.folder}/samplePluginD.jar.bin"/> <!-- compile the source code --> <javac destdir="${temp.folder}/samplePluginD.jar.bin" failonerror="false" verbose="true" debug="on" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../samplePluginC/samplePluginC.jar;../samplePluginB/lib/b.jar;../../p lugins/org.eclipse.core.runtime_2.0.0/bin;../samplePluginB/bin;../samplePluginC/ bin;../../plugins/org.eclipse.core.boot_2.0.0/bin;../../plugins/org.eclipse.core .runtime_2.0.0/runtime.jar;../../plugins/org.eclipse.core.boot_2.0.0/boot.jar;.. /samplePluginB/samplePluginB.jar"> <src path="src/"/> </javac> <!-- copy necessary resources --> <copy todir="${temp.folder}/samplePluginD.jar.bin"> <fileset dir="src/" excludes="**/*.java"/> </copy> <mkdir dir="${build.result.folder}"/> <jar jarfile="${build.result.folder}/samplePluginD.jar" basedir="${temp.folder}/samplePluginD.jar.bin"/> <delete dir="${temp.folder}/samplePluginD.jar.bin"/> </target> I can find "../samplePluginB/lib/b.jar" in classpath, which is good, but "../samplePluginA/lib/a.jar" which I would expect to be there is missing. The whole example is attached.
Created attachment 1387 [details] example
Seems like a bug. Needs further investigation.
Yes, it is a bug in AbstractBuildScriptGenerator.addPrerequisiteLibraries(). When a plug-in exports a pre-requisite, instead of calling the same method ( AbstractBuildScriptGenerator.addPrerequisiteLibraries() ) for its pre- requisite, we only add its libraries (calling addLibraries()). So, if the pre- requisite plug-in also exports another plug-in, it won't be added to the compile path. The fix is trivial. We only need to call addPrerequisiteLibraries() instead of addLibraries(). Since addPrerequisiteLibraries() calls addLibraries() there is no major change in the algorithm. Recommend fixing.
Is there any risk of encountering a project cycle in the proposed fix? If so this could hang Eclipse.
Yes, it could happen. Just tried and got a StackOverflowError (runtime- workbench).
Handling the project cycle would be a major change. Since the workaround is simple (writing a custom build.xml) we will defer the fix to after 2.0. Workaround: 1) Generate a build.xml using PDE Build (Create Plug-in JARs) 2) Edit the build.properties with the following line: custom = true 3) Add the missing JARs to the build.xml (javac task) 4) Release the new build.properties and build.xml to the repository
Add to readme.
Reopening.
*** Bug 21405 has been marked as a duplicate of this bug. ***
Fixed and released to HEAD. The cycle issue has also been handled. If a cycle is found a CoreException will be thrown.