public List<Jar> getClasspath() { init(); return super.getClasspath(); }
/** * Answer the string of the resource that it has in the container. * * @param resource * The resource to look for * @return * @throws Exception */ public String getClasspathEntrySuffix(File resource) throws Exception { for (Jar jar : getClasspath()) { File source = jar.getSource(); if (source != null) { source = source.getCanonicalFile(); String sourcePath = source.getAbsolutePath(); String resourcePath = resource.getAbsolutePath(); if (resourcePath.startsWith(sourcePath)) { // Make sure that the path name is translated correctly // i.e. on Windows the \ must be translated to / String filePath = resourcePath.substring(sourcePath.length() + 1); return filePath.replace(File.separatorChar, '/'); } } } return null; }
/** * * @param jar * @param name * @param instructions */ private void doExpand(Jar jar, String name, Map<Instruction, Map<String, String>> instructions, boolean mandatory) { Set<Instruction> superfluous = removeMarkedDuplicates(instructions .keySet()); for (Iterator<Jar> c = getClasspath().iterator(); c.hasNext();) { Jar now = c.next(); doExpand(jar, instructions, now, superfluous); } if (mandatory && superfluous.size() > 0) { StringBuffer sb = new StringBuffer(); String del = "Instructions in " + name + " that are never used: "; for (Iterator<Instruction> i = superfluous.iterator(); i.hasNext();) { Instruction p = i.next(); sb.append(del); sb.append(p.getPattern()); del = ", "; } warning(sb.toString()); } }
/** * * @param jar * @param name * @param instructions */ private void doExpand(Jar jar, String name, Map<Instruction, Map<String, String>> instructions, boolean mandatory) { Set<Instruction> superfluous = removeMarkedDuplicates(instructions.keySet()); for (Iterator<Jar> c = getClasspath().iterator(); c.hasNext();) { Jar now = c.next(); doExpand(jar, instructions, now, superfluous); } if (mandatory && superfluous.size() > 0) { StringBuilder sb = new StringBuilder(); String del = "Instructions in " + name + " that are never used: "; for (Iterator<Instruction> i = superfluous.iterator(); i.hasNext();) { Instruction p = i.next(); sb.append(del); sb.append(p.toString()); del = "\n "; } sb.append("\nClasspath: "); sb.append(Processor.join(getClasspath())); sb.append("\n"); warning("%s",sb.toString()); if (isPedantic()) diagnostics = true; } }
a.addClasspath(dep.getArtifact()); pw.println(a.getClasspath()); a.build();
public Builder getSubBuilder() throws Exception { Builder builder = new Builder(this); builder.setBase(getBase()); for (Jar file : getClasspath()) { builder.addClasspath(file); } return builder; }
public Builder getSubBuilder() throws Exception { Builder builder = new Builder(this); builder.setBase(getBase()); for (Jar file : getClasspath()) { builder.addClasspath(file); } return builder; }
error(diagnostic(pack, getClasspath(), classpathEntry.source)); continue loop; warning(diagnostic(pack, getClasspath(), classpathEntry.source)); overwriteResource = false;
error(diagnostic(pack, getClasspath(), classpathEntry.source)); continue loop; warning("%s", diagnostic(pack, getClasspath(), classpathEntry.source)); overwriteResource = false; break;
private void doExpand(Jar jar) throws IOException { if (getClasspath().size() == 0 && (getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null)) warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one"); Map<Instruction, Map<String, String>> privateMap = replaceWitInstruction( getHeader(PRIVATE_PACKAGE), PRIVATE_PACKAGE); Map<Instruction, Map<String, String>> exportMap = replaceWitInstruction( getHeader(EXPORT_PACKAGE), EXPORT_PACKAGE); if (isTrue(getProperty(Constants.UNDERTEST))) { privateMap.putAll(replaceWitInstruction(parseHeader(getProperty( Constants.TESTPACKAGES, "test;presence:=optional")), TESTPACKAGES)); } if (!privateMap.isEmpty()) doExpand(jar, "Private-Package, or -testpackages", privateMap, true); if (!exportMap.isEmpty()) { Jar exports = new Jar("exports"); doExpand(exports, "Export-Package", exportMap, true); jar.addAll(exports); exports.close(); } if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()) { warning("Neither Export-Package, Private-Package, -testpackages is set, therefore no packages will be included"); } }
private void doExpand(Jar jar) throws IOException { if (getClasspath().size() == 0 && (getProperty(EXPORT_PACKAGE) != null || getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null)) warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one"); Map<Instruction, Map<String, String>> privateMap = Instruction .replaceWithInstruction(getHeader(PRIVATE_PACKAGE)); Map<Instruction, Map<String, String>> exportMap = Instruction .replaceWithInstruction(getHeader(EXPORT_PACKAGE)); if (isTrue(getProperty(Constants.UNDERTEST))) { privateMap.putAll(Instruction.replaceWithInstruction(parseHeader(getProperty( Constants.TESTPACKAGES, "test;presence:=optional")))); } if (!privateMap.isEmpty()) doExpand(jar, "Private-Package, or -testpackages", privateMap, true); if (!exportMap.isEmpty()) { Jar exports = new Jar("exports"); doExpand(exports, EXPORT_PACKAGE, exportMap, true); jar.addAll(exports); exports.close(); } if (!isNoBundle()) { if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly() && getProperty(EXPORT_CONTENTS) == null) { warning("None of Export-Package, Provide-Package, Private-Package, -testpackages, or -exportcontents is set, therefore no packages will be included"); } } }