FELIX-491: add bundle:deploy to bundle lifecycle (off by default, use -DremoteOBR to enable)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@628622 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
index 884d873..4f76943 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
@@ -81,9 +81,9 @@
public void execute()
{
- if ( "NONE".equalsIgnoreCase( obrRepository ) )
+ if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
{
- getLog().info( "OBR clean disabled (enable with -DobrRepository)" );
+ getLog().info( "Local OBR clean disabled (enable with -DobrRepository)" );
return;
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
index ca45711..60db94f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
@@ -53,7 +53,14 @@
private boolean ignoreLock;
/**
- * OBR Repository.
+ * Remote OBR Repository.
+ *
+ * @parameter expression="${remoteOBR}" default-value="NONE"
+ */
+ private String remoteOBR;
+
+ /**
+ * Local OBR Repository.
*
* @parameter expression="${obrRepository}"
*/
@@ -122,13 +129,19 @@
getLog().info( "Ignoring packaging type " + project.getPackaging() );
return;
}
- else if ( "NONE".equalsIgnoreCase( obrRepository ) )
+ else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
{
- getLog().info( "OBR update disabled (enable with -DobrRepository)" );
+ getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
return;
}
- URI tempURI = ObrUtils.findRepositoryXml( "", obrRepository );
+ // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
+ if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
+ {
+ remoteOBR = obrRepository;
+ }
+
+ URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
String repositoryName = new File( tempURI.getPath() ).getName();
Log log = getLog();
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java
index eaf2375..d09bbda 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java
@@ -51,7 +51,14 @@
private boolean ignoreLock;
/**
- * OBR Repository.
+ * Remote OBR Repository.
+ *
+ * @parameter expression="${remoteOBR}"
+ */
+ private String remoteOBR;
+
+ /**
+ * Local OBR Repository.
*
* @parameter expression="${obrRepository}"
*/
@@ -123,13 +130,19 @@
getLog().info( "Ignoring packaging type " + project.getPackaging() );
return;
}
- else if ( "NONE".equalsIgnoreCase( obrRepository ) )
+ else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
{
- getLog().info( "OBR update disabled (enable with -DobrRepository)" );
+ getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
return;
}
- URI tempURI = ObrUtils.findRepositoryXml( "", obrRepository );
+ // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
+ if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
+ {
+ remoteOBR = obrRepository;
+ }
+
+ URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
String repositoryName = new File( tempURI.getPath() ).getName();
Log log = getLog();
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java
index 3c0b003..e96d0c4 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java
@@ -83,9 +83,9 @@
getLog().info( "Ignoring packaging type " + project.getPackaging() );
return;
}
- else if ( "NONE".equalsIgnoreCase( obrRepository ) )
+ else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
{
- getLog().info( "OBR update disabled (enable with -DobrRepository)" );
+ getLog().info( "Local OBR update disabled (enable with -DobrRepository)" );
return;
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java
index 5565b3c..7e0c3cf 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java
@@ -74,9 +74,9 @@
getLog().info( "Ignoring packaging type " + project.getPackaging() );
return;
}
- else if ( "NONE".equalsIgnoreCase( obrRepository ) )
+ else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
{
- getLog().info( "OBR update disabled (enable with -DobrRepository)" );
+ getLog().info( "Local OBR update disabled (enable with -DobrRepository)" );
return;
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUtils.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUtils.java
index 857fc82..01bc86f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUtils.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrUtils.java
@@ -23,6 +23,7 @@
import java.net.URI;
import java.util.Collection;
import java.util.Iterator;
+import java.util.regex.Pattern;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -50,8 +51,10 @@
{
String targetPath = obrRepository;
+ Pattern ignoredNames = Pattern.compile( "^(true|false|none|null)?$", Pattern.CASE_INSENSITIVE );
+
// Combine location settings into a single repository location
- if ( null == targetPath || targetPath.trim().length() == 0 || "true".equalsIgnoreCase( targetPath ) )
+ if ( null == targetPath || ignoredNames.matcher( targetPath ).matches() )
{
targetPath = mavenRepository + '/' + REPO_XML;
}
diff --git a/bundleplugin/src/main/resources/META-INF/plexus/components.xml b/bundleplugin/src/main/resources/META-INF/plexus/components.xml
index 5c99b1f..a7e3bbf 100644
--- a/bundleplugin/src/main/resources/META-INF/plexus/components.xml
+++ b/bundleplugin/src/main/resources/META-INF/plexus/components.xml
@@ -39,8 +39,8 @@
org.apache.felix:maven-bundle-plugin:install
</install>
<deploy>
- org.apache.maven.plugins:maven-deploy-plugin:deploy<!--,
- TODO: org.apache.felix:maven-bundle-plugin:deploy-->
+ org.apache.maven.plugins:maven-deploy-plugin:deploy,
+ org.apache.felix:maven-bundle-plugin:deploy
</deploy>
</phases>
<!-- END SNIPPET: bundle-lifecycle -->