Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 269201 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarAntExporter.java (-6 / +182 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2011 IBM Corporation and others.
2
 * Copyright (c) 2007, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-22 Link Here
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 220257 [jar application] ANT build file does not create Class-Path Entry in Manifest
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 220257 [jar application] ANT build file does not create Class-Path Entry in Manifest
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
14
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
14
 *******************************************************************************/
15
 *******************************************************************************/
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
17
18
import java.io.File;
17
import java.io.FileNotFoundException;
19
import java.io.FileNotFoundException;
18
import java.io.IOException;
20
import java.io.IOException;
19
import java.util.ArrayList;
21
import java.util.ArrayList;
22
import java.util.HashMap;
23
import java.util.Map;
24
25
import org.w3c.dom.Document;
26
import org.w3c.dom.Element;
27
import org.w3c.dom.Node;
20
28
21
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.IPath;
Lines 24-29 Link Here
24
import org.eclipse.core.runtime.MultiStatus;
32
import org.eclipse.core.runtime.MultiStatus;
25
import org.eclipse.core.runtime.Path;
33
import org.eclipse.core.runtime.Path;
26
import org.eclipse.core.runtime.Status;
34
import org.eclipse.core.runtime.Status;
35
36
import org.eclipse.core.resources.ResourcesPlugin;
27
37
28
import org.eclipse.debug.core.ILaunchConfiguration;
38
import org.eclipse.debug.core.ILaunchConfiguration;
29
39
Lines 47-52 Link Here
47
 */
57
 */
48
public abstract class FatJarAntExporter {
58
public abstract class FatJarAntExporter {
49
59
60
	private static final String ANT_PROPERTYNAME_DIR_BUILDFILE= "dir.buildfile"; //$NON-NLS-1$
61
	private static final String ANT_PROPERTYNAME_DIR_WORKSPACE= "dir.workspace"; //$NON-NLS-1$
62
	private static final String ANT_PROPERTYNAME_DIR_JARFILE= "dir.jarfile"; //$NON-NLS-1$
63
	
64
	private static final String ANT_PROPERTY_DIR_BUILDFILE= "${"+ANT_PROPERTYNAME_DIR_BUILDFILE+"}"; //$NON-NLS-1$ //$NON-NLS-2$
65
	private static final String ANT_PROPERTY_DIR_WORKSPACE= "${"+ANT_PROPERTYNAME_DIR_WORKSPACE+"}"; //$NON-NLS-1$ //$NON-NLS-2$
66
	private static final String ANT_PROPERTY_DIR_JARFILE= "${"+ANT_PROPERTYNAME_DIR_JARFILE+"}"; //$NON-NLS-1$ //$NON-NLS-2$
67
50
	protected static class SourceInfo {
68
	protected static class SourceInfo {
51
69
52
		public final boolean isJar;
70
		public final boolean isJar;
Lines 60-69 Link Here
60
		}
78
		}
61
	}
79
	}
62
80
81
	/**
82
	 * Helper class for path-substitutions.
83
	 * This class manages a set of path substitutions.
84
	 * On apply the longest substitution is chosen.  
85
	 */
86
	private static class PathSubstituter {
87
		private Map<String, String> pathSubstitutions= new HashMap<String, String>();
88
89
		public PathSubstituter addSubstitution(String basePath, String baseReplacement) {
90
			pathSubstitutions.put(basePath, baseReplacement);
91
			return this;
92
		}
93
94
		public String substitute(String path) {
95
			int len= 0;
96
			String result= path;
97
			for (String basePath : pathSubstitutions.keySet()) {
98
				if (basePath.length() < len) {
99
					continue;
100
				}
101
				if (path.equals(basePath)) {
102
					result= pathSubstitutions.get(basePath);
103
					break;
104
				}
105
				if (path.startsWith(basePath + File.separator)) {
106
					len= basePath.length();
107
					result= pathSubstitutions.get(basePath) + path.substring(len);
108
				}
109
			}
110
			return result;
111
		}
112
	}
113
	
63
	private ILaunchConfiguration fLaunchConfiguration;
114
	private ILaunchConfiguration fLaunchConfiguration;
64
	private IPath fAbsJarfile;
115
	private IPath fAbsJarfile;
65
	private IPath fAntScriptLocation;
116
	private IPath fAntScriptLocation;
66
117
	
118
	private String fBuildfileDir;
119
	private String fWorkspaceDir;
120
	private String fJarfileDir;
121
	
122
	private PathSubstituter pathSubstituter;
123
	
67
	/**
124
	/**
68
	 * Create an instance of the ANT exporter. An ANT exporter can generate an ANT script
125
	 * Create an instance of the ANT exporter. An ANT exporter can generate an ANT script
69
	 * at the given ant script location for the given launch configuration
126
	 * at the given ant script location for the given launch configuration
Lines 75-80 Link Here
75
		fLaunchConfiguration= launchConfiguration;
132
		fLaunchConfiguration= launchConfiguration;
76
		fAbsJarfile= jarLocation;
133
		fAbsJarfile= jarLocation;
77
		fAntScriptLocation= antScriptLocation;
134
		fAntScriptLocation= antScriptLocation;
135
		pathSubstituter= new PathSubstituter();
136
		try {
137
			fBuildfileDir= antScriptLocation.toFile().getParentFile().getCanonicalPath();
138
			pathSubstituter.addSubstitution(fBuildfileDir, ANT_PROPERTY_DIR_BUILDFILE);
139
		} catch (Exception e) {
140
			JavaPlugin.log(e);
141
			fBuildfileDir= "?"; //$NON-NLS-1$
142
		}
143
		try {
144
			fJarfileDir= jarLocation.toFile().getParentFile().getCanonicalPath();
145
			pathSubstituter.addSubstitution(fJarfileDir, ANT_PROPERTY_DIR_JARFILE);
146
		} catch (Exception e) {
147
			JavaPlugin.log(e);
148
			fJarfileDir= "?"; //$NON-NLS-1$
149
		}
150
		try {
151
			fWorkspaceDir= ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile().getCanonicalPath();
152
			pathSubstituter.addSubstitution(fWorkspaceDir, ANT_PROPERTY_DIR_WORKSPACE);
153
		} catch (Exception e) {
154
			JavaPlugin.log(e);
155
			fWorkspaceDir= "?"; //$NON-NLS-1$
156
		}
78
	}
157
	}
79
158
80
	/**
159
	/**
Lines 98-112 Link Here
98
					new Status(IStatus.ERROR, JavaUI.ID_PLUGIN,
177
					new Status(IStatus.ERROR, JavaUI.ID_PLUGIN,
99
							Messages.format(FatJarPackagerMessages.FatJarPackageWizard_antScript_error_readingOutputFile, new Object[] {
178
							Messages.format(FatJarPackagerMessages.FatJarPackageWizard_antScript_error_readingOutputFile, new Object[] {
100
									BasicElementLabels.getPathLabel(fAntScriptLocation, true), e.getLocalizedMessage() })
179
									BasicElementLabels.getPathLabel(fAntScriptLocation, true), e.getLocalizedMessage() })
101
							)
180
					));
102
					);
103
		} catch (IOException e) {
181
		} catch (IOException e) {
104
			throw new CoreException(
182
			throw new CoreException(
105
					new Status(IStatus.ERROR, JavaUI.ID_PLUGIN,
183
					new Status(IStatus.ERROR, JavaUI.ID_PLUGIN,
106
							Messages.format(FatJarPackagerMessages.FatJarPackageWizard_antScript_error_writingOutputFile, new Object[] {
184
							Messages.format(FatJarPackagerMessages.FatJarPackageWizard_antScript_error_writingOutputFile, new Object[] {
107
									BasicElementLabels.getPathLabel(fAntScriptLocation, true), e.getLocalizedMessage() })
185
									BasicElementLabels.getPathLabel(fAntScriptLocation, true), e.getLocalizedMessage() })
108
							)
186
					));
109
					);
110
		}
187
		}
111
	}
188
	}
112
189
Lines 164-169 Link Here
164
		return result;
241
		return result;
165
	}
242
	}
166
243
244
	
245
	/**
246
	 * Adds dir properties to ANT-Buildfile:
247
	 * <ul>
248
	 * <li>&lt;property name="dir.buildfile" value="." /&gt;</li>
249
	 * <li>&lt;property name="dir.workspace" value="${dir.buildfile}/../.." /&gt;</li>
250
	 * <li>&lt;property name="dir.jarfile" value="C:/TEMP" /&gt;</li>
251
	 * </ul>
252
	 * 
253
	 * @param document the DOM document of the ant build script
254
	 * @param project the project tag
255
	 */
256
	protected void addBaseDirProperties(Document document, Element project) {
257
		
258
		Node comment= document.createComment("define folder properties"); //$NON-NLS-1$
259
		project.appendChild(comment);
260
		
261
		Element property= document.createElement("property"); //$NON-NLS-1$
262
		property.setAttribute("name", ANT_PROPERTYNAME_DIR_BUILDFILE); //$NON-NLS-1$ 
263
		property.setAttribute("value", "."); //$NON-NLS-1$ //$NON-NLS-2$ 
264
		project.appendChild(property);
265
266
		property= document.createElement("property"); //$NON-NLS-1$
267
		property.setAttribute("name", ANT_PROPERTYNAME_DIR_WORKSPACE); //$NON-NLS-1$ 
268
		property.setAttribute("value", getWorkspaceRelativeDir()); //$NON-NLS-1$ 
269
		project.appendChild(property);
270
271
		property= document.createElement("property"); //$NON-NLS-1$
272
		property.setAttribute("name", ANT_PROPERTYNAME_DIR_JARFILE); //$NON-NLS-1$ 
273
		property.setAttribute("value", getJarfileRelativeDir()); //$NON-NLS-1$ 
274
		project.appendChild(property);
275
	}
276
277
	
278
	/**
279
	 * Converts the given filename relative to any of the ant-property-dirs:
280
	 * <ul>
281
	 * <li>buidfile-dir (where the ant script is)</li>
282
	 * <li>workspace-dir (eclipse workspace dir)</li>
283
	 * <li>jarfile-dir (where the jar is written to)</li>
284
	 * </ul>
285
	 * 
286
	 * @param absFilename filename whose base dir is substituted 
287
	 * @return either the original filename or a relative path from one of the base-dirs
288
	 */
289
	protected String substituteBaseDirs(String absFilename) {
290
		String canonicleFilename;
291
		try {
292
			canonicleFilename= new File(absFilename).getCanonicalPath();
293
		} catch (IOException e) {
294
			e.printStackTrace();
295
			return absFilename;
296
		}
297
		String result= pathSubstituter.substitute(canonicleFilename);
298
		result= result.replace(File.separatorChar, '/');
299
		return result;
300
	}
301
302
	/**
303
	 * Returns the workspace-dir path relative to buildfile-dir.
304
	 * 
305
	 * @return the relative path for the workspace-dir
306
	 */
307
	protected String getWorkspaceRelativeDir() {
308
		String result;
309
		if (fBuildfileDir.startsWith(fWorkspaceDir + File.separator)) {
310
			int lastSlash= fWorkspaceDir.length();
311
			result= "${dir.buildfile}" + File.separator + ".."; //$NON-NLS-1$ //$NON-NLS-2$
312
			lastSlash= fBuildfileDir.indexOf(File.separator, lastSlash + 1);
313
			while (lastSlash != -1) {
314
				result+= File.separator + ".."; //$NON-NLS-1$
315
				lastSlash= fBuildfileDir.indexOf(File.separator, lastSlash + 1);
316
			}
317
		}
318
		else {
319
			result= new PathSubstituter()
320
					.addSubstitution(fBuildfileDir, ANT_PROPERTY_DIR_BUILDFILE)
321
					.substitute(fWorkspaceDir);
322
		}
323
		result= result.replace(File.separatorChar, '/');
324
		return result;
325
	}
326
327
328
	/**
329
	 * Returns jarfile-dir path relative to buildfile-dir or workspace-dir.
330
	 * 
331
	 * @return the relative path for the jarfile-dir
332
	 */
333
	protected String getJarfileRelativeDir() {
334
		String result= new PathSubstituter()
335
				.addSubstitution(fBuildfileDir, ANT_PROPERTY_DIR_BUILDFILE)
336
				.addSubstitution(fWorkspaceDir, ANT_PROPERTY_DIR_WORKSPACE)
337
				.substitute(fJarfileDir);
338
		result= result.replace(File.separatorChar, '/');
339
		return result;
340
	}
341
342
	
167
	/**
343
	/**
168
	 * Create an ANT script at the given location.
344
	 * Create an ANT script at the given location.
169
	 * 
345
	 * 
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/FatJarRsrcUrlAntExporter.java (-6 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2011 IBM Corporation and others.
2
 * Copyright (c) 2008, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262748 [jar exporter] extract constants for string literals in JarRsrcLoader et al.
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262748 [jar exporter] extract constants for string literals in JarRsrcLoader et al.
14
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
14
 *******************************************************************************/
15
 *******************************************************************************/
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
package org.eclipse.jdt.internal.ui.jarpackagerfat;
16
17
Lines 94-111 Link Here
94
		Element project= document.createElement("project"); //$NON-NLS-1$
95
		Element project= document.createElement("project"); //$NON-NLS-1$
95
		project.setAttribute("name", "Create Runnable Jar for Project " + projectName + " with Jar-in-Jar Loader"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
96
		project.setAttribute("name", "Create Runnable Jar for Project " + projectName + " with Jar-in-Jar Loader"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
96
		project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
97
		project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
97
		comment= document.createComment("this file was created by Eclipse Runnable JAR Export Wizard"); //$NON-NLS-1$
98
		comment= document.createComment("this file was created by Eclipse Runnable JAR file Export Wizard"); //$NON-NLS-1$
98
		project.appendChild(comment);
99
		project.appendChild(comment);
99
		comment= document.createComment("ANT 1.7 is required                                        "); //$NON-NLS-1$
100
		comment= document.createComment("ANT 1.7 is required"); //$NON-NLS-1$
100
		project.appendChild(comment);
101
		project.appendChild(comment);
101
		document.appendChild(project);
102
		document.appendChild(project);
103
104
		addBaseDirProperties(document, project);
102
105
103
		Element target= document.createElement("target"); //$NON-NLS-1$
106
		Element target= document.createElement("target"); //$NON-NLS-1$
104
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
107
		target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
105
		project.appendChild(target);
108
		project.appendChild(target);
106
109
107
		Element jar= document.createElement("jar"); //$NON-NLS-1$
110
		Element jar= document.createElement("jar"); //$NON-NLS-1$
108
		jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s 
111
		jar.setAttribute("destfile", substituteBaseDirs(absJarname)); //$NON-NLS-1$s 
109
		target.appendChild(jar);
112
		target.appendChild(jar);
110
113
111
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
114
		Element manifest= document.createElement("manifest"); //$NON-NLS-1$
Lines 149-160 Link Here
149
			if (sourceInfo.isJar) {
152
			if (sourceInfo.isJar) {
150
				File jarFile= new File(sourceInfo.absPath);
153
				File jarFile= new File(sourceInfo.absPath);
151
				Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$
154
				Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$
152
				fileset.setAttribute("dir", jarFile.getParent()); //$NON-NLS-1$
155
				fileset.setAttribute("dir", substituteBaseDirs(jarFile.getParent())); //$NON-NLS-1$
153
				fileset.setAttribute("includes", jarFile.getName()); //$NON-NLS-1$ 
156
				fileset.setAttribute("includes", jarFile.getName()); //$NON-NLS-1$ 
154
				jar.appendChild(fileset);
157
				jar.appendChild(fileset);
155
			} else {
158
			} else {
156
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
159
				Element fileset= document.createElement("fileset"); //$NON-NLS-1$
157
				fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
160
				fileset.setAttribute("dir", substituteBaseDirs(sourceInfo.absPath)); //$NON-NLS-1$
158
				jar.appendChild(fileset);
161
				jar.appendChild(fileset);
159
			}
162
			}
160
		}
163
		}
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackFatJarAntExporter.java (-5 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2011 IBM Corporation and others.
2
 * Copyright (c) 2009, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 83258 [jar exporter] Deploy java application as executable jar
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
16
Lines 67-84 Link Here
67
			Element project= document.createElement("project"); //$NON-NLS-1$
68
			Element project= document.createElement("project"); //$NON-NLS-1$
68
			project.setAttribute("name", "Create Runnable Jar for Project " + projectName); //$NON-NLS-1$ //$NON-NLS-2$
69
			project.setAttribute("name", "Create Runnable Jar for Project " + projectName); //$NON-NLS-1$ //$NON-NLS-2$
69
			project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
70
			project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
71
			document.appendChild(project);
70
			comment= document.createComment("this file was created by Eclipse Runnable JAR Export Wizard"); //$NON-NLS-1$
72
			comment= document.createComment("this file was created by Eclipse Runnable JAR Export Wizard"); //$NON-NLS-1$
71
			project.appendChild(comment);
73
			project.appendChild(comment);
72
			comment= document.createComment("ANT 1.7 is required                                        "); //$NON-NLS-1$
74
			comment= document.createComment("ANT 1.7 is required                                        "); //$NON-NLS-1$
73
			project.appendChild(comment);
75
			project.appendChild(comment);
74
			document.appendChild(project);
76
77
			addBaseDirProperties(document, project);
75
78
76
			Element target= document.createElement("target"); //$NON-NLS-1$
79
			Element target= document.createElement("target"); //$NON-NLS-1$
77
			target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
80
			target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
78
			project.appendChild(target);
81
			project.appendChild(target);
79
82
80
			Element jar= document.createElement("jar"); //$NON-NLS-1$
83
			Element jar= document.createElement("jar"); //$NON-NLS-1$
81
			jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s
84
			jar.setAttribute("destfile", substituteBaseDirs(absJarname)); //$NON-NLS-1$s
82
			jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$
85
			jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$
83
			target.appendChild(jar);
86
			target.appendChild(jar);
84
87
Lines 99-110 Link Here
99
				SourceInfo sourceInfo= sourceInfos[i];
102
				SourceInfo sourceInfo= sourceInfos[i];
100
				if (sourceInfo.isJar) {
103
				if (sourceInfo.isJar) {
101
					Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$
104
					Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$
102
					zipfileset.setAttribute("src", sourceInfo.absPath); //$NON-NLS-1$
105
					zipfileset.setAttribute("src", substituteBaseDirs(sourceInfo.absPath)); //$NON-NLS-1$
103
					zipfileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$
106
					zipfileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$
104
					jar.appendChild(zipfileset);
107
					jar.appendChild(zipfileset);
105
				} else {
108
				} else {
106
					Element fileset= document.createElement("fileset"); //$NON-NLS-1$
109
					Element fileset= document.createElement("fileset"); //$NON-NLS-1$
107
					fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
110
					fileset.setAttribute("dir", substituteBaseDirs(sourceInfo.absPath)); //$NON-NLS-1$
108
					jar.appendChild(fileset);
111
					jar.appendChild(fileset);
109
				}
112
				}
110
			}
113
			}
(-)ui/org/eclipse/jdt/internal/ui/jarpackagerfat/UnpackJarAntExporter.java (-7 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2011 IBM Corporation and others.
2
 * Copyright (c) 2008, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-15 Link Here
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
10
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
11
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
12
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter
13
 *     Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
package org.eclipse.jdt.internal.ui.jarpackagerfat;
15
16
Lines 78-90 Link Here
78
			comment= document.createComment("ANT 1.7 is required                                        "); //$NON-NLS-1$
79
			comment= document.createComment("ANT 1.7 is required                                        "); //$NON-NLS-1$
79
			project.appendChild(comment);
80
			project.appendChild(comment);
80
			document.appendChild(project);
81
			document.appendChild(project);
82
			addBaseDirProperties(document, project);
81
83
82
			Element target= document.createElement("target"); //$NON-NLS-1$
84
			Element target= document.createElement("target"); //$NON-NLS-1$
83
			target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
85
			target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$
84
			project.appendChild(target);
86
			project.appendChild(target);
85
87
86
			Element jar= document.createElement("jar"); //$NON-NLS-1$
88
			Element jar= document.createElement("jar"); //$NON-NLS-1$
87
			jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s
89
			jar.setAttribute("destfile", substituteBaseDirs(absJarname)); //$NON-NLS-1$s
88
			target.appendChild(jar);
90
			target.appendChild(jar);
89
91
90
			Element manifest= document.createElement("manifest"); //$NON-NLS-1$
92
			Element manifest= document.createElement("manifest"); //$NON-NLS-1$
Lines 114-131 Link Here
114
				SourceInfo sourceInfo= sourceInfos[i];
116
				SourceInfo sourceInfo= sourceInfos[i];
115
				if (!sourceInfo.isJar) {
117
				if (!sourceInfo.isJar) {
116
					Element fileset= document.createElement("fileset"); //$NON-NLS-1$
118
					Element fileset= document.createElement("fileset"); //$NON-NLS-1$
117
					fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$
119
					fileset.setAttribute("dir", substituteBaseDirs(sourceInfo.absPath)); //$NON-NLS-1$
118
					jar.appendChild(fileset);
120
					jar.appendChild(fileset);
119
				}
121
				}
120
			}
122
			}
121
123
122
124
123
			Element delete= document.createElement("delete"); //$NON-NLS-1$
125
			Element delete= document.createElement("delete"); //$NON-NLS-1$
124
			delete.setAttribute("dir", absSubfolder); //$NON-NLS-1$s
126
			delete.setAttribute("dir", substituteBaseDirs(absSubfolder)); //$NON-NLS-1$s
125
			target.appendChild(delete);
127
			target.appendChild(delete);
126
128
127
			Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
129
			Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$
128
			mkdir.setAttribute("dir", absSubfolder); //$NON-NLS-1$s
130
			mkdir.setAttribute("dir", substituteBaseDirs(absSubfolder)); //$NON-NLS-1$s
129
			target.appendChild(mkdir);
131
			target.appendChild(mkdir);
130
132
131
			// add libraries
133
			// add libraries
Lines 133-140 Link Here
133
				SourceInfo sourceInfo= sourceInfos[i];
135
				SourceInfo sourceInfo= sourceInfos[i];
134
				if (sourceInfo.isJar) {
136
				if (sourceInfo.isJar) {
135
					Element copy= document.createElement("copy"); //$NON-NLS-1$
137
					Element copy= document.createElement("copy"); //$NON-NLS-1$
136
					copy.setAttribute("file", sourceInfo.absPath); //$NON-NLS-1$
138
					copy.setAttribute("file", substituteBaseDirs(sourceInfo.absPath)); //$NON-NLS-1$
137
					copy.setAttribute("todir", absSubfolder); //$NON-NLS-1$
139
					copy.setAttribute("todir", substituteBaseDirs(absSubfolder)); //$NON-NLS-1$
138
					target.appendChild(copy);
140
					target.appendChild(copy);
139
				}
141
				}
140
			}
142
			}

Return to bug 269201