Refactor code to re-use maven-obr-plugin utility methods
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@615731 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
index 83a847d..ec76b6d 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
@@ -24,11 +24,10 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
-import java.util.List;
+import java.net.URI;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -128,22 +127,12 @@
ArtifactRepository ar = m_project.getDistributionManagementArtifactRepository();
// locate the obr.xml file
- String obrXmlFile = null;
- List l = m_project.getResources();
- for ( int i = 0; i < l.size(); i++ )
- {
- File f = new File( ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml" );
- if ( f.exists() )
- {
- obrXmlFile = ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml";
- break;
- }
- }
+ URI obrXml = ObrUtils.findObrXml( m_project.getResources() );
// the obr.xml file is not present
- if ( obrXmlFile == null )
+ if ( null == obrXml )
{
- getLog().warn( "obr.xml is not present, use default" );
+ getLog().info( "obr.xml is not present, use default" );
}
File repoDescriptorFile = null;
@@ -305,7 +294,7 @@
file = new PathFile( "file:/" + repoDescriptorFile.getAbsolutePath() );
- ObrUpdate obrUpdate = new ObrUpdate( file, obrXmlFile, m_project, m_fileInLocalRepo, PathFile
+ ObrUpdate obrUpdate = new ObrUpdate( file, obrXml, m_project, m_fileInLocalRepo, PathFile
.uniformSeparator( m_settings.getLocalRepository() ), userConfig, getLog() );
obrUpdate.updateRepository();