activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r413960 - in /incubator/activemq/trunk/tooling/maven-dependency-plugin: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/maven/ src...
Date Tue, 13 Jun 2006 19:27:08 GMT
Author: chirino
Date: Tue Jun 13 12:27:08 2006
New Revision: 413960

URL: http://svn.apache.org/viewvc?rev=413960&view=rev
Log:
Adding a little mojo that will allow us to create a repo for activemq dependencies.

Added:
    incubator/activemq/trunk/tooling/maven-dependency-plugin/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/.classpath
    incubator/activemq/trunk/tooling/maven-dependency-plugin/.project
    incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/org.eclipse.jdt.core.prefs
    incubator/activemq/trunk/tooling/maven-dependency-plugin/pom.xml
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/test/
    incubator/activemq/trunk/tooling/maven-dependency-plugin/src/test/java/

Added: incubator/activemq/trunk/tooling/maven-dependency-plugin/.classpath
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/.classpath?rev=413960&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/.classpath (added)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/.classpath Tue Jun 13 12:27:08
2006
@@ -0,0 +1,19 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar"/>
+  <classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-archiver/1.0-alpha-3/plexus-archiver-1.0-alpha-3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-model/2.0/maven-model-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact-manager/2.0/maven-artifact-manager-2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+</classpath>
\ No newline at end of file

Added: incubator/activemq/trunk/tooling/maven-dependency-plugin/.project
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/.project?rev=413960&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/.project (added)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/.project Tue Jun 13 12:27:08
2006
@@ -0,0 +1,18 @@
+<projectDescription>
+  <name>maven-dependency-plugin</name>
+  <comment>The Apache Software Foundation provides support for the Apache community
of open-source software projects.
+    The Apache projects are characterized by a collaborative, consensus based development
process, an open and
+    pragmatic software license, and a desire to create high quality software that leads the
way in its field.
+    We consider ourselves not simply a group of projects sharing a server, but rather a community
of developers
+    and users.</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments/>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/org.eclipse.jdt.core.prefs?rev=413960&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/org.eclipse.jdt.core.prefs
(added)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/.settings/org.eclipse.jdt.core.prefs
Tue Jun 13 12:27:08 2006
@@ -0,0 +1,5 @@
+#Tue Jun 13 01:49:56 EDT 2006
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.compliance=1.4

Added: incubator/activemq/trunk/tooling/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/pom.xml?rev=413960&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/pom.xml (added)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/pom.xml Tue Jun 13 12:27:08 2006
@@ -0,0 +1,45 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>incubator-activemq</groupId>
+    <artifactId>maven-dependency-plugin</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>maven-plugin</packaging>
+    <name>ActiveMQ :: Dependency Plugin</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+            <version>3.8.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-archiver</artifactId>
+            <version>1.0-alpha-3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+            <version>2.0</version>
+        </dependency>
+    </dependencies>
+</project>

Added: incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java?rev=413960&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
(added)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
Tue Jun 13 12:27:08 2006
@@ -0,0 +1,151 @@
+/**
+ *
+ * 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.activemq.maven;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.deployer.ArtifactDeployer;
+import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * This is a useful little mojo that allows you to copy all the transitive
+ * dependencies to a specified deployment repository.  Great if you want to create
+ * a new repo for your project's dependencies.
+ * 
+ * @goal deploy-dependencies
+ * @requiresDependencyResolution compile
+ * @phase process-sources
+ */
+public class DeployDependenciesMojo extends AbstractMojo {
+
+    /**
+     * @parameter expression="${project}"
+     * @readonly
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * @parameter expression="${reactorProjects}"
+     * @required
+     * @readonly
+     */
+    private List reactorProjects;
+
+    /**
+     * @parameter expression="${component.org.apache.maven.artifact.deployer.ArtifactDeployer}"
+     * @required
+     * @readonly
+     */
+    private ArtifactDeployer deployer;
+
+    /**
+     * @parameter expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter
+     */
+    private ArtifactRepository deploymentRepository;
+    
+    /**
+     * @parameter
+     */
+    private String deploymentRepositoryId;
+    
+    /**
+     * @parameter
+     */
+    private String deploymentRepositoryUrl;
+
+    /**
+     * @parameter
+     */
+    private ArtifactRepositoryLayout deploymentRepositoryLayout = new DefaultRepositoryLayout();
+    
+    
+    /**
+     * 
+     */
+    public void execute() throws MojoExecutionException {
+        
+        if ( deploymentRepository == null )
+        {
+            deploymentRepository = new DefaultArtifactRepository(deploymentRepositoryId,
deploymentRepositoryUrl, deploymentRepositoryLayout); 
+        }
+        
+
+        getLog().info("repo type="+deploymentRepository.getClass());
+        
+        String protocol = deploymentRepository.getProtocol();
+        
+        if( protocol.equals( "scp" ) )
+        {
+                File sshFile = new File( System.getProperty( "user.home" ), ".ssh" );
+
+                if( !sshFile.exists() )
+                {
+                        sshFile.mkdirs();
+                }   
+        }
+        
+        Set dependencies = new HashSet();
+
+        for (Iterator i = reactorProjects.iterator(); i.hasNext();) {
+            MavenProject p = (MavenProject) i.next();
+            List dependencyArtifacts = p.getTestArtifacts();
+            
+            if( dependencyArtifacts !=null )
+                dependencies.addAll(dependencyArtifacts);
+        }
+
+        for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+            deploy( artifact );
+        }
+        
+    }
+
+    private void deploy(Artifact artifact) throws MojoExecutionException {
+        try
+        {
+            getLog().info( "Copying " + artifact.getFile().getAbsolutePath() + " to " + deploymentRepository
);            
+            deployer.deploy( artifact.getFile(), artifact, deploymentRepository, localRepository
);
+        }
+        catch ( ArtifactDeploymentException e )
+        {
+            throw new MojoExecutionException( e.getMessage(), e );
+        }
+    }
+
+
+}



Mime
View raw message