
at.bestsolution.maven.osgi.pack.ProductPackagePlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-osgi-package-plugin Show documentation
Show all versions of maven-osgi-package-plugin Show documentation
Maven Plug-in to execute OSGi-Applications from maven
The newest version!
/*******************************************************************************
* Copyright (c) 2017 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tom Schindl - initial API and implementation
*******************************************************************************/
package at.bestsolution.maven.osgi.pack;
import java.io.File;
import java.io.PrintWriter;
import java.util.Map.Entry;
import java.util.jar.JarFile;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomWriter;
@Mojo(name="package-product", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE)
public class ProductPackagePlugin extends AbstractMojo {
@Parameter(defaultValue = "${project}", required = true, readonly = true)
private MavenProject project;
@Parameter(defaultValue="${project.basedir}")
private File projectDir;
@Parameter(required=true)
private Product product;
// @Component
// private P2ApplicationLauncher launcher;
//
// @Parameter(defaultValue = "${project.build.directory}/repository")
// private File repositoryLocation;
//
// @Parameter(defaultValue = "${project.build.directory}/products")
// private File productDirectory;
// @Parameter(defaultValue="false", alias="feature-based")
// private boolean featureBased;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Xpp3Dom xppProduct = new Xpp3Dom("product");
xppProduct.setAttribute("name", product.name);
xppProduct.setAttribute("uid", product.uid);
xppProduct.setAttribute("id", product.id);
xppProduct.setAttribute("application", product.application);
xppProduct.setAttribute("version", product.version);
xppProduct.setAttribute("useFeatures", product.useFeatures+"");
xppProduct.setAttribute("includeLaunchers", product.includeLaunchers+"");
Xpp3Dom configIni = new Xpp3Dom("configIni");
configIni.setAttribute("use", "default");
xppProduct.addChild(configIni);
Xpp3Dom launcherArgs = new Xpp3Dom("launcherArgs");
Xpp3Dom programArgs = new Xpp3Dom("programArgs");
for( String a : product.launcherArgs.programArguments ) {
programArgs.setValue(a);
}
launcherArgs.addChild(programArgs);
Xpp3Dom vmArgs = new Xpp3Dom("vmArgs");
for( Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy