From 949095c3ee577a6d22cf1af8f5ffe0e4006c7e31 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 21 Oct 2008 04:06:31 +0000 Subject: Configure the eclipse profile to run eclipse:eclipse and process-resources git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@706507 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca-equinox/modules/thirdparty-library/pom.xml | 54 +++++---- .../bundle/plugin/ThirdPartyBundleBuildMojo.java | 135 +-------------------- .../ThirdPartyBundleClasspathGeneratorMojo.java | 2 +- 3 files changed, 35 insertions(+), 156 deletions(-) diff --git a/branches/sca-equinox/modules/thirdparty-library/pom.xml b/branches/sca-equinox/modules/thirdparty-library/pom.xml index 16d57ef5fc..61269c9a53 100644 --- a/branches/sca-equinox/modules/thirdparty-library/pom.xml +++ b/branches/sca-equinox/modules/thirdparty-library/pom.xml @@ -41,53 +41,63 @@ tuscany-host-tomcat jar 1.4-SNAPSHOT - + eclipse + process-resources - maven-clean-plugin - - - - ${basedir}/lib - - * - - false - - - - - + maven-clean-plugin + + + + ${basedir}/lib + + * + + false + + + + + org.apache.tuscany.sca tuscany-maven-bundle-plugin assemble-thirdparty-bundle + generate-resources assemble-thirdparty-bundle - org.apache.tuscany.sca.thirdparty.library + org.apache.tuscany.sca.thirdparty.library + + + generate-pde-classpath + process-resources + + generate-pde-classpath + + + - - org.apache.tuscany.sca - tuscany-maven-bundle-plugin + maven-eclipse-plugin - generate-pde-classpath + generate-eclipse-metadata + generate-resources - generate-pde-classpath + eclipse @@ -96,5 +106,5 @@ - + diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java index cf15c5602d..4dd42967ae 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleBuildMojo.java @@ -25,31 +25,19 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.Set; import java.util.jar.Manifest; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactCollector; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.versioning.VersionRange; 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; -import org.apache.maven.shared.dependency.tree.DependencyTree; -import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; -import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; /** * @version $Rev$ $Date$ * @goal assemble-thirdparty-bundle - * @phase process-resources + * @phase generate-resources * @requiresDependencyResolution test * @description Build an OSGi bundle for third party dependencies */ @@ -63,96 +51,6 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { */ private MavenProject project; - /** - * The basedir of the project. - * - * @parameter expression="${basedir}" - * @required @readonly - */ - private File basedir; - - /** - * Used to look up Artifacts in the remote repository. - * - * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}" - * @required - * @readonly - */ - private org.apache.maven.artifact.factory.ArtifactFactory factory; - - /** - * Used to look up Artifacts in the remote repository. - * - * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}" - * @required - * @readonly - */ - private org.apache.maven.artifact.resolver.ArtifactResolver resolver; - - /** - * Location of the local repository. - * - * @parameter expression="${localRepository}" - * @readonly - * @required - */ - private org.apache.maven.artifact.repository.ArtifactRepository local; - - /** - * List of Remote Repositories used by the resolver - * - * @parameter expression="${project.remoteArtifactRepositories}" - * @readonly - * @required - */ - private java.util.List remoteRepos; - - /** - * Dependency tree builder - * - * @component - */ - private DependencyTreeBuilder dependencyTreeBuilder; - - /** - * Artifact factory - * - * @component - */ - private ArtifactFactory artifactFactory; - - /** - * @component - */ - private ArtifactMetadataSource artifactMetadataSource; - - /** - * @component - */ - private ArtifactCollector collector; - - /** - * The local repository - * - * @parameter expression="${localRepository}" - * @required - */ - private ArtifactRepository localRepository; - - /** - * The remote repositories - * - * @parameter expression="${project.remoteArtifactRepositories}" - */ - private List remoteRepositories; - - /** - * Artifact resolver - * - * @component - */ - private ArtifactResolver artifactResolver; - /** * The bundle symbolic name * @@ -167,19 +65,9 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { return; } - DependencyTree dependencyTree; - try { - dependencyTree = dependencyTreeBuilder.buildDependencyTree(project, - localRepository, artifactFactory, - artifactMetadataSource, collector ); - - } catch (DependencyTreeBuilderException e) { - throw new MojoExecutionException("Could not build dependency tree", e); - } - String projectGroupId = project.getGroupId(); Set jarFiles = new HashSet(); - for (Object o : dependencyTree.getArtifacts()) { + for (Object o : project.getArtifacts()) { Artifact artifact = (Artifact)o; if (!(Artifact.SCOPE_COMPILE.equals(artifact.getScope()) || Artifact.SCOPE_RUNTIME.equals(artifact.getScope()))) { @@ -194,25 +82,6 @@ public class ThirdPartyBundleBuildMojo extends AbstractMojo { if (projectGroupId.equals(artifact.getGroupId())) { continue; } - - VersionRange versionRange = artifact.getVersionRange(); - if (versionRange == null) - versionRange = VersionRange.createFromVersion(artifact.getVersion()); - Artifact dependencyArtifact = artifactFactory.createDependencyArtifact(artifact.getGroupId(), - artifact.getArtifactId(), - versionRange, - artifact.getType(), - artifact.getClassifier(), - artifact.getScope()); - - try { - artifactResolver.resolve(dependencyArtifact, remoteRepositories, localRepository); - } catch (ArtifactResolutionException e) { - log.warn("Artifact " + artifact + " could not be resolved."); - } catch (ArtifactNotFoundException e) { - log.warn("Artifact " + artifact + " could not be found."); - } - artifact = dependencyArtifact; if (log.isDebugEnabled()) { log.debug("Artifact: " + artifact); diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java index 57384fda5d..4eab9a82ec 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ThirdPartyBundleClasspathGeneratorMojo.java @@ -36,7 +36,7 @@ import org.apache.maven.project.MavenProject; /** * @version $Rev$ $Date$ * @goal generate-pde-classpath - * @phase process-classes + * @phase process-resources * @requiresDependencyResolution test * @description Adjust third party bundle classpath */ -- cgit v1.2.3