You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by pd...@apache.org on 2006/03/10 23:04:09 UTC

svn commit: r384931 - in /incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin: ./ src/main/java/com/unity/maven2/plugin/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/servicemix/ src/main/java/org/apache/servicemix/m...

Author: pdodds
Date: Fri Mar 10 14:04:08 2006
New Revision: 384931

URL: http://svn.apache.org/viewcvs?rev=384931&view=rev
Log:
Migrated package names to Apache and also fixed up the handling of dependencies based on Eclipse libs being in the scope PROVIDED

Added:
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/
      - copied from r384789, incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/com/unity/maven2/plugin/
Removed:
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/com/unity/maven2/plugin/
Modified:
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/   (props changed)
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/pom.xml
    incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/EclipsePluginMojo.java

Propchange: incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 10 14:04:08 2006
@@ -0,0 +1,3 @@
+target
+.classpath
+.project

Modified: incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/pom.xml?rev=384931&r1=384930&r2=384931&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/pom.xml (original)
+++ incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/pom.xml Fri Mar 10 14:04:08 2006
@@ -1,25 +1,52 @@
-<project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	
+	Copyright 2005 The Apache Software Foundation
+	
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+-->
+<!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 déc. 2005) $ -->
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://maven.apache.org/POM/4.0.0">
 
 	<parent>
-    <groupId>incubator-servicemix</groupId>
-    <artifactId>servicemix</artifactId>
-    <version>3.0-SNAPSHOT</version>
-    <relativePath>../../pom.xml</relativePath>
-  </parent>
-  
+		<groupId>incubator-servicemix</groupId>
+		<artifactId>servicemix</artifactId>
+		<version>3.0-SNAPSHOT</version>
+		<relativePath>../../pom.xml</relativePath>
+	</parent>
+
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>org.apache.servicemix.plugins</groupId>
 	<artifactId>maven2-eclipse-plugin-plugin</artifactId>
 	<packaging>maven-plugin</packaging>
 	<version>1.0-SNAPSHOT</version>
 	<name>ServiceMix :: Maven2 Eclipse Plugin Plugin</name>
-	
+
 	<scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin</developerConnection>
-    <url>http://svn.apache.org/viewcvs.cgi/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/</url>
-  </scm>
-  
+		<connection>
+			scm:svn:http://svn.apache.org/repos/asf/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin
+		</connection>
+		<developerConnection>
+			scm:svn:https://svn.apache.org/repos/asf/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin
+		</developerConnection>
+		<url>
+			http://svn.apache.org/viewcvs.cgi/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/
+		</url>
+	</scm>
+
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.maven</groupId>

Modified: incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/EclipsePluginMojo.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/EclipsePluginMojo.java?rev=384931&r1=384789&r2=384931&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/EclipsePluginMojo.java (original)
+++ incubator/servicemix/trunk/tooling/maven2-eclipse-plugin-plugin/src/main/java/org/apache/servicemix/maven/plugin/EclipsePluginMojo.java Fri Mar 10 14:04:08 2006
@@ -1,4 +1,19 @@
-package com.unity.maven2.plugin;
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.maven.plugin;
 
 import java.io.BufferedWriter;
 import java.io.File;
@@ -10,7 +25,7 @@
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.model.Dependency;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -44,8 +59,6 @@
 	 */
 	private String pluginClass;
 
-	private static final String LIB_DIRECTORY = "";
-
 	/**
 	 * Directory where the plugin.xml file will be auto-generated.
 	 * 
@@ -92,7 +105,7 @@
 				if (it.hasNext())
 					writer.write(",\n");
 			}
-			
+
 			writer.write("\nBundle-Activator: ");
 			writer.write(pluginClass);
 			writer.write("\nBundle-Vendor: ");
@@ -135,62 +148,55 @@
 
 	}
 
-	public List getEmbeddedDependencies() {
+	/**
+	 * Helper method that returns a list of the artifacts that need to be
+	 * embedded into the plugin
+	 * 
+	 * @return
+	 */
+	private List getEmbeddedDependencies() {
 		List uris = new ArrayList();
 		Set artifacts = project.getArtifacts();
 
 		File destinationDir = new File(projectBuildDirectory);
 		for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
 			Artifact artifact = (Artifact) iter.next();
-
-			// TODO: utilise appropriate methods from project builder
-			ScopeArtifactFilter filter = new ScopeArtifactFilter(
-					Artifact.SCOPE_RUNTIME);
-
-			if (!artifact.getGroupId().equals("eclipse")) {
-				try {
-					FileUtils.copyFileToDirectory(artifact.getFile(),
-							destinationDir);
-				} catch (IOException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-				if (!artifact.isOptional() && filter.include(artifact)) {
+			try {
+				if (!artifact.isOptional()
+						&& Artifact.SCOPE_RUNTIME.equals(artifact.getScope())) {
 					String type = artifact.getType();
 					if ("jar".equals(type)) {
 						uris.add("target/" + artifact.getFile().getName());
+						FileUtils.copyFileToDirectory(artifact.getFile(),
+								destinationDir);
 					}
 				}
+			} catch (IOException e) {
+				throw new RuntimeException("Unable to handle dependency : "
+						+ artifact.getArtifactId(), e);
 			}
 		}
 
 		return uris;
 	}
 
-	public List getEclipseDependencies() {
+	/**
+	 * Helper method that returns a list of the dependencies that need to be
+	 * referenced
+	 * 
+	 * @return
+	 */
+	private List getEclipseDependencies() {
 		List uris = new ArrayList();
-		Set artifacts = project.getArtifacts();
+		List artifacts = project.getDependencies();
 
-		File destinationDir = new File(projectBuildDirectory);
 		for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-
-			// TODO: utilise appropriate methods from project builder
-			ScopeArtifactFilter filter = new ScopeArtifactFilter(
-					Artifact.SCOPE_RUNTIME);
-
-			if (artifact.getGroupId().equals("eclipse")) {
-
-				if (!artifact.isOptional() && filter.include(artifact)) {
-					String type = artifact.getType();
-					if ("jar".equals(type)) {
-						uris.add(artifact.getArtifactId());
-					}
-				}
+			Dependency dependency = (Dependency) iter.next();
+			if (!dependency.isOptional()
+					&& Artifact.SCOPE_PROVIDED.equals(dependency.getScope())) {
+				uris.add(dependency.getArtifactId());
 			}
-
 		}
-
 		return uris;
 	}
 }