You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2013/10/02 16:15:23 UTC
svn commit: r1528484 - in /karaf/trunk: ./
manual/src/main/webapp/developers-guide/
tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/
Author: cschneider
Date: Wed Oct 2 14:15:22 2013
New Revision: 1528484
URL: http://svn.apache.org/r1528484
Log:
KARAF-2494 Fixing some bugs in artifact resolution
Modified:
karaf/trunk/RELEASE-NOTES
karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-features-add-to-repository.conf
karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AbstractFeatureMojo.java
karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/FeatureMetaDataExporter.java
Modified: karaf/trunk/RELEASE-NOTES
URL: http://svn.apache.org/viewvc/karaf/trunk/RELEASE-NOTES?rev=1528484&r1=1528483&r2=1528484&view=diff
==============================================================================
--- karaf/trunk/RELEASE-NOTES (original)
+++ karaf/trunk/RELEASE-NOTES Wed Oct 2 14:15:22 2013
@@ -15,6 +15,16 @@
* limitations under the License.
*/
+ Apache Karaf 3.0.0.RC2
+ ======================
+
+ Migration
+ ---------
+
+ karaf-maven-plugin:
+ For the goal features-add-to-repository. The karaf core features are not added automatically anymore. You have to add the needed ones in descriptors.
+
+
Apache Karaf 3.0.0.RC1
======================
Modified: karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-features-add-to-repository.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-features-add-to-repository.conf?rev=1528484&r1=1528483&r2=1528484&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-features-add-to-repository.conf (original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-features-add-to-repository.conf Wed Oct 2 14:15:22 2013
@@ -25,7 +25,8 @@ The example below copies the bundles for
<goal>features-add-to-repository</goal>
</goals>
<configuration>
- <descriptors>
+ <descriptors>
+ <descriptor>mvn:org.apache.karaf.features/standard/3.0.0/xml/features</descriptor>
<descriptor>mvn:my.groupid/my.artifactid/1.0.0/xml/features</descriptor>
</descriptors>
<features>
@@ -45,7 +46,7 @@ The example below copies the bundles for
h3. Parameters
|| Name || Type || Description ||
-| {{descriptors}} | {{String[]}} | List of features XML descriptors where the features are defined \\ NB: Karaf core features descriptors (standard and enteprise) are automatically added in this list |
+| {{descriptors}} | {{String[]}} | List of features XML descriptors where the features are defined |
| {{features}} | {{String[]}} | List of features that bundles should be copied to the repository directory |
| {{repository}} | {{File}} | The directory where the bundles will be copied by the plugin goal |
-| {{karafVersion}} | {{String}} | Target Karaf version to use to resolve the Karaf core features descriptors (standard and enterprise) \\ Default value is the Karaf plugin version |
\ No newline at end of file
+
Modified: karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AbstractFeatureMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AbstractFeatureMojo.java?rev=1528484&r1=1528483&r2=1528484&view=diff
==============================================================================
--- karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AbstractFeatureMojo.java (original)
+++ karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AbstractFeatureMojo.java Wed Oct 2 14:15:22 2013
@@ -32,16 +32,13 @@ import org.apache.karaf.tooling.features
import org.apache.karaf.tooling.utils.MojoSupport;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Common functionality for mojos that need to reolve features
*/
public abstract class AbstractFeatureMojo extends MojoSupport {
-
- protected static final String KARAF_CORE_STANDARD_FEATURE_URL = "mvn:org.apache.karaf.features/standard/%s/xml/features";
- protected static final String KARAF_CORE_ENTERPRISE_FEATURE_URL = "mvn:org.apache.karaf.features/enterprise/%s/xml/features";
+
/**
* @parameter
*/
@@ -55,12 +52,6 @@ public abstract class AbstractFeatureMoj
protected List<String> features;
/**
- * the target karaf version used to resolve Karaf core features descriptors
- *
- * @parameter
- */
- protected String karafVersion;
- /**
* @parameter
*/
protected boolean addTransitiveFeatures = true;
@@ -153,11 +144,12 @@ public abstract class AbstractFeatureMoj
Collections.singletonList(artifact.getRepository())
: remoteRepos;
resolver.resolve(artifact, usedRemoteRepos, localRepo);
- } catch (AbstractArtifactResolutionException e) {
+ } catch (Exception e) {
if (failOnArtifactResolutionError) {
- throw new RuntimeException("Can't resolve bundle " + artifact, e);
+ throw new RuntimeException("Can't resolve artifact " + artifact, e);
}
- getLog().error("Can't resolve bundle " + artifact, e);
+ getLog().warn("Can't resolve artifact " + artifact);
+ getLog().debug(e);
}
}
@@ -211,15 +203,6 @@ public abstract class AbstractFeatureMoj
protected Set<Feature> resolveFeatures() throws MojoExecutionException {
Set<Feature> featuresSet = new HashSet<Feature>();
- if (karafVersion == null) {
- Package p = Package.getPackage("org.apache.karaf.tooling.features");
- karafVersion = p.getImplementationVersion();
- }
-
- addFeatureRepo(String.format(KARAF_CORE_ENTERPRISE_FEATURE_URL, karafVersion));
- addFeatureRepo(String.format(KARAF_CORE_STANDARD_FEATURE_URL, karafVersion));
- addFeatureRepo(String.format(KARAF_CORE_STANDARD_FEATURE_URL, karafVersion));
-
try {
Set<String> artifactsToCopy = new HashSet<String>();
Map<String, Feature> featuresMap = new HashMap<String, Feature>();
Modified: karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java?rev=1528484&r1=1528483&r2=1528484&view=diff
==============================================================================
--- karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java (original)
+++ karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java Wed Oct 2 14:15:22 2013
@@ -82,9 +82,13 @@ public class AddToRepositoryMojo extends
}
protected void copy(Artifact artifact, File destRepository) {
- getLog().info("Copying artifact: " + artifact);
- File destFile = new File(destRepository, getRelativePath(artifact));
- copy(artifact.getFile(), destFile);
+ try {
+ getLog().info("Copying artifact: " + artifact);
+ File destFile = new File(destRepository, getRelativePath(artifact));
+ copy(artifact.getFile(), destFile);
+ } catch (Exception e) {
+ getLog().warn("Error copying artifact " + artifact, e);
+ }
}
/**
Modified: karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/FeatureMetaDataExporter.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/FeatureMetaDataExporter.java?rev=1528484&r1=1528483&r2=1528484&view=diff
==============================================================================
--- karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/FeatureMetaDataExporter.java (original)
+++ karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/FeatureMetaDataExporter.java Wed Oct 2 14:15:22 2013
@@ -65,9 +65,11 @@ public class FeatureMetaDataExporter {
writer.add(factory.createAttribute("name", name));
Artifact artifact = bundle.getArtifact();
bundle.readManifest();
- String[] results = bundle.getBundleSymbolicName().split(";");
- writer.add(factory.createAttribute("Bundle-SymbolicName", results[0]));
- writer.add(factory.createAttribute("Bundle-Version", bundle.getBundleVersion()));
+ if (bundle.getBundleSymbolicName() != null) {
+ String[] results = bundle.getBundleSymbolicName().split(";");
+ writer.add(factory.createAttribute("Bundle-SymbolicName", results[0]));
+ writer.add(factory.createAttribute("Bundle-Version", bundle.getBundleVersion()));
+ }
writer.add(factory.createAttribute("groupId", artifact.getGroupId()));
writer.add(factory.createAttribute("artifactId", artifact.getArtifactId()));
if (artifact.getType() != null) {