protected void executeWithArtifacts()

in src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java [50:75]


    protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
        FileWriter out = null;
        try {
            out = new FileWriter(outputFile);

            BundleList bundleList = getInitializedBundleList();
            for (StartLevel level : bundleList.getStartLevels()) {
                for (Bundle bundle : level.getBundles()) {
                    String line = String.format("mvn:%s/%s/%s@%d\n", bundle.getGroupId(), bundle.getArtifactId(),
                            bundle.getVersion(), level.getStartLevel());
                    out.write(line);
                }
            }

            projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
        } catch (IOException e) {
            throw new MojoExecutionException("Unable to write " + outputFile.getName(), e);
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                }
            }
        }
    }