Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-01-12 03:53:59 +0000
committerIgor Fedorenko2011-01-12 03:53:59 +0000
commitc022f237d630ae17d8a0691dc21e007c0ff4c095 (patch)
tree04c1a3cfd93052698157bb10334437d8739b9c39
parentb37de4a7ce7c96f31b10569c0041d25f5b1ea385 (diff)
downloadm2e-core-c022f237d630ae17d8a0691dc21e007c0ff4c095.tar.gz
m2e-core-c022f237d630ae17d8a0691dc21e007c0ff4c095.tar.xz
m2e-core-c022f237d630ae17d8a0691dc21e007c0ff4c095.zip
separate bundle for default lifecycle mapping metadata
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/build.properties3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java62
-rw-r--r--org.eclipse.m2e.feature/feature.xml6
-rw-r--r--org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml38
-rw-r--r--org.eclipse.m2e.lifecyclemapping.defaults/.project22
-rw-r--r--org.eclipse.m2e.lifecyclemapping.defaults/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.m2e.lifecyclemapping.defaults/build.properties2
-rw-r--r--org.eclipse.m2e.lifecyclemapping.defaults/lifecycle-mapping-metadata.xml (renamed from org.eclipse.m2e.core/resources/default-lifecycle-mapping-metadata.xml)36
-rw-r--r--org.eclipse.m2e.lifecyclemapping.defaults/plugin.properties10
-rw-r--r--org.eclipse.m2e.parent/pom.xml1
-rw-r--r--org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF3
11 files changed, 118 insertions, 73 deletions
diff --git a/org.eclipse.m2e.core/build.properties b/org.eclipse.m2e.core/build.properties
index ae6a11bb..67bbb7d5 100644
--- a/org.eclipse.m2e.core/build.properties
+++ b/org.eclipse.m2e.core/build.properties
@@ -19,8 +19,7 @@ bin.includes = plugin.xml,\
.,\
intro/,\
schema/,\
- about.html,\
- resources/
+ about.html
jars.compile.order = .
output.. = target/classes
source.. = src/,\
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
index 4e76cf1f..e5fd5430 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
@@ -80,7 +80,7 @@ import org.eclipse.m2e.core.project.configurator.NoopLifecycleMapping;
public class LifecycleMappingFactory {
private static Logger log = LoggerFactory.getLogger(LifecycleMappingFactory.class);
- private static final String DEFAULT_LIFECYCLE_METADATA_SOURCE_PATH = "/resources/default-lifecycle-mapping-metadata.xml";
+ private static final String DEFAULT_LIFECYCLE_METADATA_BUNDLE = "org.eclipse.m2e.lifecyclemapping.defaults";
private static final String LIFECYCLE_MAPPING_METADATA_SOURCE_PATH = "/lifecycle-mapping-metadata.xml";
@@ -497,18 +497,8 @@ public class LifecycleMappingFactory {
return null;
}
if(defaultLifecycleMappingMetadataSource == null) {
- InputStream is = LifecycleMappingFactory.class.getResourceAsStream(DEFAULT_LIFECYCLE_METADATA_SOURCE_PATH);
- try {
- defaultLifecycleMappingMetadataSource = new LifecycleMappingMetadataSourceXpp3Reader().read(is);
- } catch(IOException e) {
- throw new LifecycleMappingConfigurationException("Cannot read default lifecycle mapping metadata", e);
- } catch(XmlPullParserException e) {
- throw new LifecycleMappingConfigurationException("Cannot parse default lifecycle mapping metadata", e);
- } catch(RuntimeException e) {
- throw new LifecycleMappingConfigurationException("Cannot load default lifecycle mapping metadata", e);
- } finally {
- IOUtil.close(is);
- }
+ Bundle bundle = Platform.getBundle(DEFAULT_LIFECYCLE_METADATA_BUNDLE);
+ defaultLifecycleMappingMetadataSource = getMetadataSource(bundle);
}
return defaultLifecycleMappingMetadataSource;
}
@@ -617,34 +607,42 @@ public class LifecycleMappingFactory {
}
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint configuratorsExtensionPoint = registry.getExtensionPoint(EXTENSION_LIFECYCLE_MAPPING_METADATA_SOURCE);
+ IExtensionPoint configuratorsExtensionPoint = registry
+ .getExtensionPoint(EXTENSION_LIFECYCLE_MAPPING_METADATA_SOURCE);
if(configuratorsExtensionPoint != null) {
IExtension[] configuratorExtensions = configuratorsExtensionPoint.getExtensions();
for(IExtension extension : configuratorExtensions) {
RegistryContributor contributor = (RegistryContributor) extension.getContributor();
Bundle bundle = bundles.get(contributor.getActualName());
- if (bundle==null) {
- continue;
- }
- URL url = bundle.getEntry(LIFECYCLE_MAPPING_METADATA_SOURCE_PATH);
- if (url != null) {
- try {
- InputStream in = url.openStream();
- try {
- LifecycleMappingMetadataSource source = new LifecycleMappingMetadataSourceXpp3Reader().read(in);
- sources.add(source);
- } finally {
- IOUtil.close(in);
- }
- } catch (IOException e) {
- log.warn("Could not read lifecycle-mapping-metadata.xml for bundle {}", bundle.getSymbolicName(), e);
- } catch (XmlPullParserException e) {
- log.warn("Could not read lifecycle-mapping-metadata.xml for bundle {}", bundle.getSymbolicName(), e);
- }
+ LifecycleMappingMetadataSource source = getMetadataSource(bundle);
+ if(source != null) {
+ sources.add(source);
}
}
}
return sources;
}
+
+ private static LifecycleMappingMetadataSource getMetadataSource(Bundle bundle) {
+ if(bundle == null) {
+ return null;
+ }
+ URL url = bundle.getEntry(LIFECYCLE_MAPPING_METADATA_SOURCE_PATH);
+ if(url != null) {
+ try {
+ InputStream in = url.openStream();
+ try {
+ return new LifecycleMappingMetadataSourceXpp3Reader().read(in);
+ } finally {
+ IOUtil.close(in);
+ }
+ } catch(IOException e) {
+ log.warn("Could not read lifecycle-mapping-metadata.xml for bundle {}", bundle.getSymbolicName(), e);
+ } catch(XmlPullParserException e) {
+ log.warn("Could not read lifecycle-mapping-metadata.xml for bundle {}", bundle.getSymbolicName(), e);
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.m2e.feature/feature.xml b/org.eclipse.m2e.feature/feature.xml
index b8edf6f2..f550d3a5 100644
--- a/org.eclipse.m2e.feature/feature.xml
+++ b/org.eclipse.m2e.feature/feature.xml
@@ -100,4 +100,10 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.m2e.lifecyclemapping.defaults"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
diff --git a/org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml b/org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml
index d37570f9..eff31290 100644
--- a/org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml
+++ b/org.eclipse.m2e.jdt/lifecycle-mapping-metadata.xml
@@ -24,43 +24,5 @@
</pluginExecution>
</pluginExecutions>
</lifecycleMapping>
-
- <lifecycleMapping>
- <packagingType>maven-plugin</packagingType>
- <lifecycleMappingId>org.eclipse.m2e.jdt.JarLifecycleMapping</lifecycleMappingId>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <versionRange>[2.0,)</versionRange>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <configurator>
- <id>org.eclipse.m2e.jdt.javaConfigurator</id>
- </configurator>
- </action>
- </pluginExecution>
-
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <versionRange>[2.3,)</versionRange>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute runOnIncremental="false"/>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMapping>
-
</lifecycleMappings>
</lifecycleMappingMetadata>
diff --git a/org.eclipse.m2e.lifecyclemapping.defaults/.project b/org.eclipse.m2e.lifecyclemapping.defaults/.project
new file mode 100644
index 00000000..c4d629b2
--- /dev/null
+++ b/org.eclipse.m2e.lifecyclemapping.defaults/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.m2e.lifecyclemapping.defaults</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.m2e.lifecyclemapping.defaults/META-INF/MANIFEST.MF b/org.eclipse.m2e.lifecyclemapping.defaults/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..39794c09
--- /dev/null
+++ b/org.eclipse.m2e.lifecyclemapping.defaults/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.m2e.lifecyclemapping.defaults;singleton:=true
+Bundle-Version: 0.13.0.qualifier
+Require-Bundle: org.eclipse.m2e.core;bundle-version="0.13.0",
+ org.eclipse.m2e.jdt;bundle-version="0.13.0"
+Bundle-Vendor: %Bundle-Vendor
diff --git a/org.eclipse.m2e.lifecyclemapping.defaults/build.properties b/org.eclipse.m2e.lifecyclemapping.defaults/build.properties
new file mode 100644
index 00000000..80f53365
--- /dev/null
+++ b/org.eclipse.m2e.lifecyclemapping.defaults/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/,\
+ lifecycle-mapping-metadata.xml
diff --git a/org.eclipse.m2e.core/resources/default-lifecycle-mapping-metadata.xml b/org.eclipse.m2e.lifecyclemapping.defaults/lifecycle-mapping-metadata.xml
index 46376669..87e910c2 100644
--- a/org.eclipse.m2e.core/resources/default-lifecycle-mapping-metadata.xml
+++ b/org.eclipse.m2e.lifecyclemapping.defaults/lifecycle-mapping-metadata.xml
@@ -3,6 +3,42 @@
<lifecycleMappings>
+ <lifecycleMapping>
+ <packagingType>maven-plugin</packagingType>
+ <lifecycleMappingId>org.eclipse.m2e.jdt.JarLifecycleMapping</lifecycleMappingId>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <configurator>
+ <id>org.eclipse.m2e.jdt.javaConfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
+
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <versionRange>[2.3,)</versionRange>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute runOnIncremental="false"/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMapping>
</lifecycleMappings>
diff --git a/org.eclipse.m2e.lifecyclemapping.defaults/plugin.properties b/org.eclipse.m2e.lifecyclemapping.defaults/plugin.properties
new file mode 100644
index 00000000..ba291939
--- /dev/null
+++ b/org.eclipse.m2e.lifecyclemapping.defaults/plugin.properties
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2007, 2008 Sonatype, Inc.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+
+Bundle-Vendor = Sonatype, Inc.
+Bundle-Name = Default Build Lifecycle Mapping Metadata
diff --git a/org.eclipse.m2e.parent/pom.xml b/org.eclipse.m2e.parent/pom.xml
index 7db70f8f..58b57606 100644
--- a/org.eclipse.m2e.parent/pom.xml
+++ b/org.eclipse.m2e.parent/pom.xml
@@ -87,6 +87,7 @@
<module>../org.eclipse.m2e.refactoring</module>
<module>../org.eclipse.m2e.editor.xml</module>
<module>../org.eclipse.m2e.editor</module>
+ <module>../org.eclipse.m2e.lifecyclemapping.defaults</module>
<!-- common test helpers -->
<module>../org.eclipse.m2e.tests.common</module>
diff --git a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF
index ac9dd8f8..1f212b99 100644
--- a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF
+++ b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.junit,
org.eclipse.core.resources,
org.eclipse.jdt.core,
org.eclipse.debug.core,
- org.eclipse.ui.workbench
+ org.eclipse.ui.workbench,
+ org.eclipse.m2e.lifecyclemapping.defaults;bundle-version="[0.13.0,0.14.0)"
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
JavaSE-1.6

Back to the top