public void execute()

in src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java [81:121]


    public void execute() throws MojoExecutionException, MojoFailureException {
        final BundleList initializedBundleList;
        if (bundleListFile.exists()) {
            try {
                initializedBundleList = readBundleList(bundleListFile);
            } catch (IOException e) {
                throw new MojoExecutionException("Unable to read bundle list file", e);
            } catch (XmlPullParserException e) {
                throw new MojoExecutionException("Unable to read bundle list file", e);
            }
        } else {
            throw new MojoFailureException(String.format("Bundle list file %s does not exist.", bundleListFile.getAbsolutePath()));
        }

        interpolateProperties(initializedBundleList, this.project, this.mavenSession);

        final BundleListXpp3Writer writer = new BundleListXpp3Writer();
        try {
            this.bundleListOutput.getParentFile().mkdirs();
            writer.write(new FileWriter(bundleListOutput), initializedBundleList);
        } catch (IOException e) {
            throw new MojoExecutionException("Unable to write bundle list", e);
        }

        // if this project is a partial bundle list, it's the main artifact
        if ( project.getPackaging().equals(PARTIAL) ) {
            project.getArtifact().setFile(bundleListOutput);
        } else {
            // otherwise attach it as an additional artifact
            projectHelper.attachArtifact(project, TYPE, CLASSIFIER, bundleListOutput);
        }

        this.getLog().info("Attaching bundle list configuration");
        try {
            this.attachConfigurations();
        } catch (final IOException ioe) {
            throw new MojoExecutionException("Unable to attach configuration.", ioe);
        } catch (final ArchiverException ioe) {
            throw new MojoExecutionException("Unable to attach configuration.", ioe);
        }
    }