Bug 60019 - Jar task fails to merge classpaths
Summary: Jar task fails to merge classpaths
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.9.4
Hardware: PC All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2016-08-18 19:12 UTC by Stephen M
Modified: 2016-08-18 19:13 UTC (History)
1 user (show)

Trivial test case. (1.60 KB, application/zip)
2016-08-18 19:12 UTC, Stephen M

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen M 2016-08-18 19:12:34 UTC
Created attachment 34161 [details]
Trivial test case.

In our builds, we use Ant to merge several Jar files and need to keep the Classpaths set in the Manifest file.  However, after upgrading to Ant 1.9.7, the classpaths are lost when merging the Jar files.  Testing backwards we found that it works correctly in 1.9.3 and previous versions, but not in 1.9.4.

I've built a trivial test case (attached).  Unzip the testcase and enter the resulting directory.  Run "ant" and then check the Combined.jar's resulting manifest file.

Our Ant build.xml file (included in the test case) is:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created to demostrate a bug in Ant -->
<project name="TagServer" default="default" basedir=".">
	<target name="default">        
        <jar jarfile="Combined.jar" filesetmanifest="mergewithoutmain" mergeclasspathattributes="true">
            <zipfileset src="First.jar"/>
            <zipfileset src="Second.jar" />

First.jar and Second.jar are trivial, empty jar files that contain only a Manifest with Classpath set.

We expected the resulting Combined.jar file to contain a merged classpath and it does using versions of Ant < 1.9.4, but it contains a manifest with a classpath setting in newer versions of Ant.

We suspect that Bug-54171 introduced this problem, but we're not sure.