maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ogusa...@apache.org
Subject svn commit: r724468 - in /maven/mercury/trunk/mercury-ant: ./ mercury-ant-tasks/ mercury-ant-tasks/src/ mercury-ant-tasks/src/main/ mercury-ant-tasks/src/main/java/ mercury-ant-tasks/src/main/java/org/ mercury-ant-tasks/src/main/java/org/apache/ mercur...
Date Mon, 08 Dec 2008 20:17:13 GMT
Author: ogusakov
Date: Mon Dec  8 12:17:02 2008
New Revision: 724468

URL: http://svn.apache.org/viewvc?rev=724468&view=rev
Log:
MERCURY-10: adding ant wrapper

Added:
    maven/mercury/trunk/mercury-ant/   (with props)
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/   (with props)
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/build.xml
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/mercury-build.xml
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/pom.xml
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractAntTask.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractDataType.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractRepository.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/DependenciesTask.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Messages.properties
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Settings.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/antlib.xml
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/DependenciesTaskTest.java
    maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/resources/
    maven/mercury/trunk/mercury-ant/pom.xml

Propchange: maven/mercury/trunk/mercury-ant/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec  8 12:17:02 2008
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Propchange: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Dec  8 12:17:02 2008
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/build.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/build.xml?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/build.xml (added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/build.xml Mon Dec  8 12:17:02 2008
@@ -0,0 +1,13 @@
+<project name="test" xmlns:mvn="antlib:org.apache.maven.mercury.ant.tasks" >
+
+	<mvn:settings>
+	      <mvn:localRepositoryM2  id="localRepo" path="/app/maven.repo"/>
+	      <mvn:remoteRepositoryM2 id="central"   url="/app/maven.repo"/>
+  </mvn:settings>
+	
+  <mvn:dependencies name="all-deps" pathid="myLibs">
+    <mvn:dependency name="ant:ant:1.6.5"/>
+    <mvn:dependency name="asm:asm-xml:3.0"/>
+  </mvn:dependencies>
+
+</project>
\ No newline at end of file

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/mercury-build.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/mercury-build.xml?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/mercury-build.xml (added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/mercury-build.xml Mon Dec  8 12:17:02
2008
@@ -0,0 +1,92 @@
+<project name="test" default="compile-tests" xmlns:mvn="antlib:org.apache.maven.mercury.ant.tasks"
>
+	
+	<!--
+	    this example does not include <mvn:write .../> task, which 
+	    will be used to install / deploy artifacts into repositories
+	    nor this example show how to configure artifact 
+	     validation - for the sake of simplicity
+	-->
+
+  <target name="init">
+    <property name="settings.name" value="home-settings"/>
+    <property name="java.version" value="1.5"/>
+    
+    <property name="src" value="${basedir}/src/main/java"/>
+    <property name="target" value="${basedir}/target/classes"/>
+    
+    <property name="test.src" value="${basedir}/src/test/java"/>
+    <property name="test.target" value="${basedir}/target/test-classes"/>
+  
+    <!--
+     | configration: repositories, ?possibly profiles 
+     -->
+    <mvn:settings id="work-settings">
+          <mvn:localRepositoryM2  id="localRepo" path="/app/maven.repo"/>
+          <mvn:remoteRepositoryM2 id="central"   url="http://repo1.maven.org/maven2"/>
+    </mvn:settings>
+  
+    <mvn:settings id="home-settings">
+          <mvn:localRepositoryM2  id="localRepo" path="/app/maven.repo"/>
+          <mvn:remoteRepositoryM2 id="central"   url="http://localhost:8081/nexus/contents/groups/public"/>
+    </mvn:settings>
+  	
+  
+    <!--
+     | dependency sets, identified and referred to by id - path-like structure declarations
+     -->
+    <mvn:dependencies id="my-libs">
+      <!-- coordinates as string  -->
+      <mvn:dependency name="ant:ant:1.6.5"/>
+      <!-- coordinates as named attributes  -->
+      <mvn:dependency groupid="asm" artifactid="asm-xml" version="[3.0,4.0)"/>
+      <!-- 
+       | a set of dependencies from a pom
+       |  
+       |    will be implemented last as mercury does not know
+       |    about POMs - this will be a special read-only repository type   
+      -->
+      <mvn:dependency groupid="org.apache.maven" artifactid="maven" version="3.0-SNAPSHOT"
pom="${basedir}/pom.xml"/>
+    </mvn:dependencies>
+
+  </target>
+
+  <target name="compile" depends="init">
+  	<!--
+  	 | this is the workhorse task - creates a classpath named "compile-path"
+  	 |  and adds all the transitive dependencies from "my-libs" in compile scope 
+  	-->
+    <mvn:resolve name="resolve-compile-deps"
+                 pathid="compile-path"
+                 depref="my-libs"
+                 settingsref="${settings.name}"
+                 />
+    
+    <javac srcdir="${src}"
+           destdir="${target}"
+           classpathref="compile-path"
+           debug="on"
+           source="${java.version}"
+    />
+  </target>
+  
+  <target name="compile-tests" depends="compile">  
+    <!--
+     | this is the workhorse task - creates a classpath named "test-path"
+     |  and adds all the transitive dependencies from "my-libs" in test scope 
+    -->
+    <mvn:resolve name="resolve-test-deps"
+                 pathid="test-path"
+                 depref="my-libs"
+                 settingsref="${settings.name}"
+                 scope="test"
+                 />
+    
+    <javac srcdir="${test.src}"
+           destdir="${test.target}"
+           classpathref="test-path"
+           debug="on"
+           source="${java.version}"
+    />
+  </target>
+  
+</project>
\ No newline at end of file

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/pom.xml?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/pom.xml (added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/pom.xml Mon Dec  8 12:17:02 2008
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+  <parent>
+  <groupId>org.apache.maven.mercury</groupId>
+  <artifactId>mercury-ant</artifactId>
+  <version>1.0-alpha-1-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.maven.mercury</groupId>
+  <artifactId>mercury-ant-tasks</artifactId>
+  <name>Mercury Ant Tasks</name>
+  <description>Maven Mercury Ant tasks code</description>
+
+  <dependencies>
+
+      <dependency>
+        <groupId>ant</groupId>
+        <artifactId>ant</artifactId>
+      </dependency>
+    
+      <!-- Mercury deps -->
+      
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-virtual</artifactId>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-local-m2</artifactId>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-remote-m2</artifactId>
+      </dependency>
+      
+       <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-md-sat</artifactId>
+      </dependency>
+  
+      <!-- Maven dependencies -->
+
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-mercury</artifactId>
+      </dependency>
+  
+  </dependencies>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <artifactId>maven-shade-plugin</artifactId>
+<!--         <version>1.1</version>
+ -->
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <finalName>${project.artifactId}-all</finalName>
+              <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
+              <createDependencyReducedPom>true</createDependencyReducedPom>
+              <artifactSet>
+                <excludes>
+                  <exclude>ant:ant</exclude>
+                  <exclude>org.bouncycastle:bcprov-jdk15</exclude>
+                  <exclude>org.bouncycastle:bcpg-jdk15</exclude>
+                  <exclude>bouncycastle:bcprov-jdk15</exclude>
+                  <exclude>bouncycastle:bcpg-jdk15</exclude>
+                </excludes>
+              </artifactSet>
+              <filters>
+                <filter>
+                  <excludes>
+                    <exclude>/META-INF/BCKEY.DSA</exclude>
+                    <exclude>/META-INF/BCKEY.SF</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+
+</project>

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractAntTask.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractAntTask.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractAntTask.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractAntTask.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,29 @@
+package org.apache.maven.mercury.ant.tasks;
+
+import org.apache.tools.ant.Task;
+
+/**
+ * 
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class AbstractAntTask
+extends Task
+{
+  private String name;
+  
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName( String name )
+  {
+    this.name = name;
+  }
+  
+  
+
+}

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractDataType.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractDataType.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractDataType.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractDataType.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,26 @@
+package org.apache.maven.mercury.ant.tasks;
+
+import org.apache.tools.ant.ProjectComponent;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public abstract class AbstractDataType
+extends ProjectComponent
+{
+  private String id;
+  
+  public String getId()
+  {
+    return id;
+  }
+  
+  public void setId( String id )
+  {
+      this.id = id;
+  }
+}

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractRepository.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractRepository.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractRepository.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/AbstractRepository.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,13 @@
+package org.apache.maven.mercury.ant.tasks;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class AbstractRepository
+extends AbstractDataType
+{
+}

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/DependenciesTask.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/DependenciesTask.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/DependenciesTask.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/DependenciesTask.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,223 @@
+package org.apache.maven.mercury.ant.tasks;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.maven.mercury.artifact.ArtifactBasicMetadata;
+import org.apache.maven.mercury.metadata.DependencyBuilder;
+import org.apache.maven.mercury.metadata.DependencyBuilderFactory;
+import org.apache.maven.mercury.repository.api.Repository;
+import org.apache.maven.mercury.repository.api.RepositoryException;
+import org.apache.tools.ant.BuildException;
+import org.codehaus.plexus.lang.DefaultLanguage;
+import org.codehaus.plexus.lang.Language;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class DependenciesTask
+extends AbstractAntTask
+{
+  private static final Language _lang = new DefaultLanguage( DependenciesTask.class );
+  
+  public static final String TASK_NAME = _lang.getMessage( "dependencies.task.name" );
+  public static final String TASK_DESC = _lang.getMessage( "dependencies.task.desc" );
+  
+  private List<Dependency> _dependencies;
+  
+  private boolean _transitive = true;
+  
+  private String _pathId;
+  
+  private String _refPathId;
+  
+  private String _settingsid;
+  
+  private boolean _failonerror = true;
+  
+  //----------------------------------------------------------------------------------------
+  @Override
+  public String getDescription()
+  {
+    return TASK_DESC;
+  }
+
+  @Override
+  public String getTaskName()
+  {
+    return TASK_NAME;
+  }
+
+  @Override
+  public void execute()
+  throws BuildException
+  {
+    if( _settingsid == null )
+      if( _failonerror )
+        throw new BuildException( _lang.getMessage( "settings.id.mandatory" ));
+      else 
+        return;
+    
+    Object so = getProject().getReference( _settingsid );
+
+    if( so == null )
+      if( _failonerror )
+        throw new BuildException( _lang.getMessage( "settings.id.object.null", _settingsid
));
+      else 
+        return;
+    
+    if( ! Settings.class.isAssignableFrom( so.getClass() ) )
+      if( _failonerror )
+        throw new BuildException( _lang.getMessage( "settings.id.object.wrong", _settingsid,
so.getClass().getName() ));
+      else 
+        return;
+    
+    Settings settings = (Settings)so;
+    
+    try
+    {
+      Collection<Repository> repos = settings.getRepositories();
+    
+      DependencyBuilder db = DependencyBuilderFactory.create( DependencyBuilderFactory.JAVA_DEPENDENCY_MODEL
+                                                            , repos
+                                                            , null
+                                                            , null
+                                                            , null 
+                                                            );
+     
+    }
+    catch( Exception e )
+    {
+      if( _failonerror )
+        throw new BuildException( e.getMessage() );
+      else 
+        return;
+    }
+    
+    if( _dependencies != null )
+      for( Dependency d : _dependencies )
+        System.out.println( d._amd );
+  }
+  
+  public void setFailonerror( boolean failonerror )
+  {
+    this._failonerror = failonerror;
+  }
+
+  public String getSettingsid()
+  {
+    return _settingsid;
+  }
+
+  public void setSettingsid( String settingsid )
+  {
+    this._settingsid = settingsid;
+  }
+
+  public void setTransitive( boolean val )
+  {
+    this._transitive = val;
+  }
+
+  public boolean getTransitive()
+  {
+    return _transitive;
+  }
+  
+  public String getPathid()
+  {
+    return _pathId;
+  }
+
+  public void setPathid( String pathId )
+  {
+    this._pathId = pathId;
+  }
+
+  public String getRefpathid()
+  {
+    return _refPathId;
+  }
+
+  public void setRefpathid( String refPathId )
+  {
+    this._refPathId = refPathId;
+  }
+
+  public Dependency createDependency()
+  {
+    if( _dependencies == null )
+      _dependencies = new ArrayList<Dependency>(8);
+    
+    Dependency dep = new Dependency();
+    
+    _dependencies.add( dep );
+    
+    return dep;
+  }
+
+  public class Dependency
+  {
+    ArtifactBasicMetadata _amd;
+
+    private void init()
+    {
+      if( _amd == null )
+        _amd = new ArtifactBasicMetadata();
+    }
+
+    public void setGroupId( String groupId )
+    {
+      init();
+      
+      _amd.setArtifactId( groupId );
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+      init();
+      
+      _amd.setArtifactId( artifactId );
+    }
+
+    public void setVersion( String version )
+    {
+      init();
+      
+      _amd.setVersion( version );
+    }
+
+    public void setType( String type )
+    {
+      init();
+      
+      _amd.setVersion( type );
+    }
+
+    public void setClassifier( String classifier )
+    {
+      init();
+      
+      _amd.setClassifier( classifier );
+    }
+
+    public void setScope( String scope )
+    {
+      init();
+      
+      _amd.setScope( scope );
+    }
+
+    public void setName( String name )
+    {
+      _amd = new ArtifactBasicMetadata( name );
+    }
+
+  }
+}
\ No newline at end of file

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Messages.properties
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Messages.properties?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Messages.properties
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Messages.properties
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,5 @@
+dependencies.task.name=Mercury Dependencies
+dependencies.task.desc=this task prepares a list of dependencies, resolves them and arranges
into a path
+settings.id.mandatory=settingsid attribute is mandatory, cannot create repositories without
it
+settings.id.object.null=object pointed by {0} is null 
+settings.id.object.wrong=object pointed by {0} is of type {1} instead of Settings

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Settings.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Settings.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Settings.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/Settings.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,139 @@
+package org.apache.maven.mercury.ant.tasks;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.maven.mercury.MavenDependencyProcessor;
+import org.apache.maven.mercury.builder.api.DependencyProcessor;
+import org.apache.maven.mercury.repository.api.LocalRepository;
+import org.apache.maven.mercury.repository.api.Repository;
+import org.apache.maven.mercury.transport.api.Server;
+import org.apache.maven.mercury.util.Util;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class Settings
+extends AbstractDataType
+{
+  Collection<AbstractRepository> _repositories;
+  
+  private void init()
+  {
+    if( _repositories != null )
+      return;
+    
+    _repositories = new ArrayList<AbstractRepository>(4);
+    
+  }
+  
+  @Override
+  public void setId( String id )
+  {
+    super.setId( id );
+    
+    getProject().addReference( id, this );
+  }
+  
+  public Collection<Repository> getRepositories()
+  throws MalformedURLException
+  {
+    if( Util.isEmpty( _repositories ) )
+      return null;
+    
+    Collection<Repository> repos = new ArrayList<Repository>( _repositories.size()
);
+    
+    for( AbstractRepository ar : _repositories )
+    {
+      if( LocalRepositoryM2.class.isAssignableFrom( ar.getClass() ) )
+      {
+        LocalRepositoryM2 lr = (LocalRepositoryM2)ar;
+        
+        DependencyProcessor dp = new MavenDependencyProcessor();
+        
+        org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2 r 
+            = new org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2( lr.getId(),
new File( lr.getPath() ), dp  );
+        
+        repos.add( r );
+      }
+      else
+      {
+        RemoteRepositoryM2 rr = (RemoteRepositoryM2)ar;
+        
+        DependencyProcessor dp = new MavenDependencyProcessor();
+        
+        Server server = new Server( rr.getId(), new URL( rr.getUrl() ) );
+        
+        org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2 r 
+            = new org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2( server,
dp  );
+        
+        repos.add( r );
+      }
+    }
+    
+    return repos;
+  }
+  
+  public LocalRepositoryM2 createLocalRepositoryM2()
+  {
+    init();
+    
+    LocalRepositoryM2 r = new LocalRepositoryM2();
+    
+    _repositories.add( r );
+    
+    return r;
+  }
+  
+  public class LocalRepositoryM2
+  extends AbstractRepository
+  {
+    String _path;
+
+    public String getPath()
+    {
+      return _path;
+    }
+
+    public void setPath( String path )
+    {
+      this._path = path;
+    }
+  }
+  
+  public RemoteRepositoryM2 createRemoteRepositoryM2()
+  {
+    init();
+    
+    RemoteRepositoryM2 r = new RemoteRepositoryM2();
+    
+    _repositories.add( r );
+    
+    return r;
+  }
+
+  public class RemoteRepositoryM2
+  extends AbstractRepository
+  {
+    String _url;
+
+    public String getUrl()
+    {
+      return _url;
+    }
+
+    public void setUrl(
+        String url )
+    {
+      this._url = url;
+    }
+  }
+
+}

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/antlib.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/antlib.xml?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/antlib.xml
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/main/resources/org/apache/maven/mercury/ant/tasks/antlib.xml
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<antlib>
+
+  <taskdef name="dependencies" classname="org.apache.maven.mercury.ant.tasks.DependenciesTask"/>
+
+  <typedef name="settings" classname="org.apache.maven.mercury.ant.tasks.Settings"/>
+  
+</antlib>

Added: maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/DependenciesTaskTest.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/DependenciesTaskTest.java?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/DependenciesTaskTest.java
(added)
+++ maven/mercury/trunk/mercury-ant/mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/DependenciesTaskTest.java
Mon Dec  8 12:17:02 2008
@@ -0,0 +1,50 @@
+package org.apache.maven.mercury.ant.tasks;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class DependenciesTaskTest
+    extends TestCase
+{
+  final class Contributor
+  extends DependenciesTask
+  {
+    @SuppressWarnings("deprecation")
+    public Contributor()
+    {
+      project = new Project();
+      project.init();
+      target = new Target();
+    }
+  }
+    
+  Contributor _contributor;
+  
+  DependenciesTask.Dependency _dep;
+    
+  @Override
+  protected void setUp()
+  throws Exception
+  {
+    _contributor = new Contributor();
+    
+    _dep = _contributor.createDependency();
+    _dep.setName( "ant:ant:1.6.5" );
+    
+  }
+  
+  public void testReadDependency()
+  {
+    _contributor.execute();
+  }
+
+}

Added: maven/mercury/trunk/mercury-ant/pom.xml
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-ant/pom.xml?rev=724468&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-ant/pom.xml (added)
+++ maven/mercury/trunk/mercury-ant/pom.xml Mon Dec  8 12:17:02 2008
@@ -0,0 +1,370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>9</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.mercury</groupId>
+  <artifactId>mercury-ant</artifactId>
+  <packaging>pom</packaging>
+  <name>Mercury Ant</name>
+  <version>1.0-alpha-1-SNAPSHOT</version>
+  <description>Maven Mercury Ant is an ant-task wrapper for MErcry functionality: classpath
creation, artifact deployment .</description>
+
+  <developers>
+    <developer>
+      <name>Oleg Gusakov</name>
+    </developer>
+  </developers>
+
+  <modules>
+    <module>mercury-ant-tasks</module>
+  </modules>
+
+  <properties>
+
+    <ant.version>1.6.5</ant.version>
+    <mercury.version>1.0.0-alpha-2</mercury.version>
+    <maven.version>3.0-SNAPSHOT</maven.version>
+
+    <junit.version>3.8.2</junit.version>
+
+
+    <java.version>1.5</java.version>
+    
+    <distMgmtReleasesId>apache.releases</distMgmtReleasesId>
+    <distMgmtReleasesName>Apache Releases</distMgmtReleasesName>
+    <distMgmtReleasesUrl>scp://people.apache.org/www/people.apache.org/repo/m2-release-repository</distMgmtReleasesUrl>
+
+    <distMgmtSnapshotsId>apache.snapshots</distMgmtSnapshotsId>
+    <distMgmtSnapshotsName>Apache Snapshots</distMgmtSnapshotsName>
+    <distMgmtSnapshotsUrl>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</distMgmtSnapshotsUrl>
+
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+
+      <dependency>
+        <groupId>ant</groupId>
+        <artifactId>ant</artifactId>
+        <version>${ant.version}</version>
+      </dependency>
+    
+      <!-- Mercury deps -->
+      
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-virtual</artifactId>
+        <version>${mercury.version}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-local-m2</artifactId>
+        <version>${mercury.version}</version>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-repo-remote-m2</artifactId>
+        <version>${mercury.version}</version>
+      </dependency>
+      
+       <dependency>
+        <groupId>org.apache.maven.mercury</groupId>
+        <artifactId>mercury-md-sat</artifactId>
+        <version>${mercury.version}</version>
+      </dependency>
+  
+      <!-- Maven dependencies -->
+
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-mercury</artifactId>
+        <version>${maven.version}</version>
+      </dependency>
+  
+      <!-- Test Dependencies -->
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>${junit.version}</version>
+        <scope>test</scope>
+      </dependency>
+      
+    </dependencies>
+    
+  </dependencyManagement>
+
+
+  <dependencies>
+      
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+
+  </dependencies>
+
+
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <resources>
+      <resource>
+        <directory>src/main/java</directory>
+        <filtering>false</filtering>
+        <includes>
+            <include>**/Messages.properties</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+      </resource>
+    </resources>
+
+    <testResources>
+      <testResource>
+        <directory>src/test/java</directory>
+        <filtering>false</filtering>
+        <includes>
+            <include>**/Messages.properties</include>
+        </includes>
+      </testResource>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>false</filtering>
+      </testResource>
+    </testResources>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>package-tests</id>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>${java.version}</source>
+          <target>${java.version}</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+      </plugin>
+      <plugin>
+
+                   <artifactId>maven-enforcer-plugin</artifactId>
+                   <version>1.0-alpha-4</version>
+                   <executions>
+                       <execution>
+                           <goals>
+                               <goal>enforce</goal>
+                           </goals>
+                           <id>enforce</id>
+                           <configuration>
+                               <rules>
+                                   <bannedDependencies>
+                                       <excludes>
+                                           <exclude>*:plexus-component-api</exclude>
+                                       </excludes>
+                                       <message> plexus-component-api conflicts with
newer plexus-container-default. You probably added a dependency
+                                           that is plexus component made
+                                           with older plexus container. </message>
+                                   </bannedDependencies>
+                                   <!--  <requirePluginVersions>
+                                       <banSnapshots>false</banSnapshots>
+                                       </requirePluginVersions>-->
+                               </rules>
+                               <fail>true</fail>
+                           </configuration>
+                       </execution>
+                   </executions>
+               </plugin>
+    </plugins>
+
+  </build>
+
+  <profiles>
+    <profile>
+      <id>mercury.install.all</id>
+      <activation>
+        <property>
+          <name>mercury.install.all</name>
+          <value>true</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-enforcer-plugin</artifactId>
+            <version>1.0-alpha-3</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>enforce</goal>
+                </goals>
+                <configuration>
+                  <rules>
+                    <requireMavenVersion>
+                      <version>[2.0.9,)</version>
+                    </requireMavenVersion>
+                    <requireJavaVersion>
+                      <version>1.5.0</version>
+                    </requireJavaVersion>
+                  </rules>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>cobertura-maven-plugin</artifactId>
+            <version>2.0</version>
+            <executions>
+              <execution>
+                <id>clean</id>
+                <goals>
+                  <goal>clean</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <version>2.2</version>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-source-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-sources</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-javadocs</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
+    <profile>
+      <id>reporting-aggregate</id>
+      <!-- To generate aggregate reports -->
+      <!-- To deploy both aggregate reports for top-level project and standalone reports
for modules, call
+           mvn site -Preporting
+           mvn site:deploy
+           mvn site -Preporting-aggregate
+           mvn -N site:deploy
+      -->
+      <reporting>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-project-info-reports-plugin</artifactId>
+            <version>2.1</version>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-jxr-plugin</artifactId>
+            <version>2.1</version>
+            <configuration>
+              <aggregate>true</aggregate>
+            </configuration>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <version>2.5</version>
+            <configuration>
+              <links>
+                <link>http://java.sun.com/j2se/1.4.2/docs/api</link>
+                <link>http://java.sun.com/j2ee/1.4/docs/api</link>
+                <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+                <link>http://commons.apache.org/collections/apidocs-COLLECTIONS_3_0/</link>
+                <link>http://commons.apache.org/dbcp/apidocs/</link>
+                <link>http://commons.apache.org/fileupload/apidocs/</link>
+                <link>http://commons.apache.org/httpclient/apidocs/</link>
+                <link>http://commons.apache.org/logging/apidocs/</link>
+                <link>http://commons.apache.org/pool/apidocs/</link>
+                <link>http://junit.sourceforge.net/javadoc/</link>
+                <link>http://logging.apache.org/log4j/1.2/apidocs/</link>
+                <link>http://jakarta.apache.org/regexp/apidocs/</link>
+                <link>http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/</link>
+              </links>
+              <aggregate>true</aggregate>
+            </configuration>
+          </plugin>
+        </plugins>
+      </reporting>
+    </profile>
+  </profiles>
+
+  <distributionManagement>
+    <repository>
+      <id>${distMgmtReleasesId}</id>
+      <name>${distMgmtReleasesName}</name>
+      <url>${distMgmtReleasesUrl}</url>
+    </repository>
+    <snapshotRepository>
+      <id>${distMgmtSnapshotsId}</id>
+      <name>${distMgmtSnapshotsName}</name>
+      <url>${distMgmtSnapshotsUrl}</url>
+    </snapshotRepository>
+  </distributionManagement>
+  
+  <url>http://maven.apache.org/mercury/</url>
+  
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.codehaus.org/browse/MERCURY</url>
+  </issueManagement>
+  
+  <ciManagement>
+    <system>hudson</system>
+    <url>http://grid.sonatype.org/ci/view/Mercury/job/mercury</url>
+  </ciManagement>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/mercury/trunk/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/mercury/trunk/</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/mercury/trunk/</url>
+  </scm>
+
+</project>



Mime
View raw message