private String getExportedPackages() throws MojoExecutionException { if (exportPackages == null) { return null; } Set allpackages = new HashSet(); ArrayList<Instruction> instructions = new ArrayList<Instruction>(); StringTokenizer st = new StringTokenizer(exportPackages, ","); while (st.hasMoreTokens()) { instructions.add(Instruction.getPattern(st.nextToken().trim())); } try { File classes = new File(project.getBuild().getOutputDirectory()); if (classes.exists()) { addExportedPackages(allpackages, instructions, classes); } for (Iterator<Artifact> i = getIncludedArtifacts().iterator(); i.hasNext(); ) { Artifact a = (Artifact) i.next(); getLog().info("Processing " + a); File f = a.getFile(); addExportedPackages(allpackages, instructions, f); } } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } StringBuffer sb = new StringBuffer(); for (Iterator i = allpackages.iterator(); i.hasNext(); ) { String pkg = (String) i.next(); if (sb.length() > 0) sb.append(','); sb.append(pkg); } return sb.length() > 0 ? sb.toString() : null; }
public DependencyFilter(String expression, String defaultValue) { m_instruction = Instruction.getPattern(expression); m_defaultValue = defaultValue; }