You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2008/02/05 05:16:35 UTC
svn commit: r618534 -
/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
Author: mcculls
Date: Mon Feb 4 20:16:34 2008
New Revision: 618534
URL: http://svn.apache.org/viewvc?rev=618534&view=rev
Log:
FELIX-475: update install goal to match the one from the bundleplugin
Modified:
felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java?rev=618534&r1=618533&r2=618534&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java Mon Feb 4 20:16:34 2008
@@ -1,4 +1,4 @@
-/*
+/*
* 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
@@ -19,83 +19,80 @@
package org.apache.felix.obr.plugin;
-import java.io.File;
import java.net.URI;
+import org.apache.felix.obr.plugin.Config;
+import org.apache.felix.obr.plugin.ObrUpdate;
+import org.apache.felix.obr.plugin.ObrUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
/**
- * Install bundle metadata to local OBR.
+ * Installs bundle details in the local OBR repository
*
* @goal install
* @phase install
- * @requiresDependencyResolution compile
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrInstall extends AbstractMojo
+public final class ObrInstall extends AbstractMojo
{
/**
- * The local Maven repository.
+ * OBR Repository.
*
- * @parameter expression="${localRepository}"
- * @required
- * @readonly
+ * @parameter expression="${obrRepository}"
*/
- private ArtifactRepository m_localRepo;
+ private String obrRepository;
/**
- * path to the repository.xml.
+ * Local Repository.
*
- * @parameter expression="${repository-path}" alias="repository-path"
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
*/
- private String m_repositoryPath;
+ private ArtifactRepository localRepository;
/**
- * Project in use.
+ * The Maven project.
*
* @parameter expression="${project}"
- * @require
+ * @required
+ * @readonly
*/
+ private MavenProject project;
- private MavenProject m_project;
-
- /**
- * main method for this goal.
- * @implements org.apache.maven.plugin.Mojo.execute
- * @throws MojoExecutionException if the plugin failed
- */
- public void execute() throws MojoExecutionException
+ public void execute()
{
- // locate the obr.xml file
- URI obrXml = ObrUtils.findObrXml( m_project.getResources() );
- if ( null == obrXml )
+ if ( "NONE".equalsIgnoreCase( obrRepository ) )
{
- getLog().info( "obr.xml is not present, use default" );
+ return;
}
- // get the path to local maven repository
- String mavenRepository = m_localRepo.getBasedir();
-
- URI repoXml = ObrUtils.findRepositoryXml( mavenRepository, m_repositoryPath );
- URI bundleJar = ObrUtils.findBundleJar( m_localRepo, m_project.getArtifact() );
+ Log log = getLog();
+ ObrUpdate update;
- if ( !new File( bundleJar ).exists() )
+ try
{
- getLog().error( "file not found in local repository: " + bundleJar );
- return;
- }
+ String mavenRepository = localRepository.getBasedir();
- // use default configuration
- Config userConfig = new Config();
+ URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
+ URI obrXml = ObrUtils.findObrXml( project.getResources() );
+ URI bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact() );
- ObrUpdate update = new ObrUpdate( repoXml, obrXml, m_project, bundleJar, null, userConfig, getLog() );
+ Config userConfig = new Config();
- update.updateRepository();
+ update = new ObrUpdate( repositoryXml, obrXml, project, bundleJar, mavenRepository, userConfig, log );
+
+ update.updateRepository();
+ }
+ catch ( Exception e )
+ {
+ log.warn( "Exception while updating OBR: " + e.getLocalizedMessage(), e );
+ }
}
}