Search in sources :

Example 1 with PomFromManifest

use of aQute.bnd.maven.PomFromManifest in project bnd by bndtools.

the class bnd method _buildx.

@Description("Build project, is deprecated but here for backward compatibility")
public void _buildx(buildxOptions options) throws Exception {
    // Create a build order
    List<Builder> builders = new ArrayList<Builder>();
    List<String> order = new ArrayList<String>();
    List<String> active = new ArrayList<String>();
    for (String s : options._arguments()) {
        prebuild(active, order, builders, s);
    }
    for (Builder b : builders) {
        if (options.classpath() != null) {
            for (String f : options.classpath()) {
                b.addClasspath(getFile(f));
            }
        }
        if (options.sourcepath() != null) {
            for (String f : options.sourcepath()) {
                b.addSourcepath(getFile(f));
            }
        }
        if (options.sources())
            b.setSources(true);
        if (options.eclipse()) {
            EclipseClasspath ep = new EclipseClasspath(this, getBase().getParentFile(), getBase());
            b.addClasspath(ep.getClasspath());
            b.addClasspath(ep.getBootclasspath());
            b.addSourcepath(ep.getSourcepath());
        }
        Jar jar = b.build();
        File outputFile = b.getOutputFile(options.output());
        if (options.pom()) {
            Resource r = new PomFromManifest(jar.getManifest());
            jar.putResource("pom.xml", r);
            String path = outputFile.getName().replaceAll("\\.jar$", ".pom");
            if (path.equals(outputFile.getName()))
                path = outputFile.getName() + ".pom";
            File pom = new File(outputFile.getParentFile(), path);
            try (OutputStream os = IO.outputStream(pom)) {
                r.write(os);
            }
        }
        getInfo(b, b.getPropertiesFile().getName());
        if (isOk()) {
            b.save(outputFile, options.force());
        }
        b.close();
    }
}
Also used : EclipseClasspath(aQute.bnd.osgi.eclipse.EclipseClasspath) Builder(aQute.bnd.osgi.Builder) DocumentBuilder(javax.xml.parsers.DocumentBuilder) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) FileResource(aQute.bnd.osgi.FileResource) Resource(aQute.bnd.osgi.Resource) PomFromManifest(aQute.bnd.maven.PomFromManifest) Jar(aQute.bnd.osgi.Jar) File(java.io.File) Description(aQute.lib.getopt.Description)

Aggregations

PomFromManifest (aQute.bnd.maven.PomFromManifest)1 Builder (aQute.bnd.osgi.Builder)1 FileResource (aQute.bnd.osgi.FileResource)1 Jar (aQute.bnd.osgi.Jar)1 Resource (aQute.bnd.osgi.Resource)1 EclipseClasspath (aQute.bnd.osgi.eclipse.EclipseClasspath)1 Description (aQute.lib.getopt.Description)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1