This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag maven-launchpad-plugin-2.3.0 in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 054e38eb75ec79d0969fda995bf6392c7cf8561f Author: Justin Edelson <[email protected]> AuthorDate: Wed Nov 21 16:23:52 2012 +0000 SLING-1245 - adding pax-runner support. Thansk to Alex Collignon for the patch git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1412174 13f79535-47bb-0310-9956-ffa450edef68 --- .../CreatePaxRunnerBundleProvisionFileMojo.java | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java new file mode 100644 index 0000000..9e98997 --- /dev/null +++ b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sling.maven.projectsupport; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; +import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; +import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; + +/** + * Create and attach a Pax Runner bundle provision file. + * + * @goal create-paxrunner-provision-file + * @phase package + * @description create a Pax Runner bundle provision file + * @requiresDependencyResolution test + */ +public class CreatePaxRunnerBundleProvisionFileMojo extends AbstractUsingBundleListMojo { + + private static final String CLASSIFIER = "bundles"; + + private static final String TYPE = "pax"; + + /** + * The output directory. + * + * @parameter default-value="${project.build.directory}/bundles-pax" + */ + private File outputFile; + + @Override + 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) { + } + } + } + } +} -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
