Cleaned up package structure
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java b/src/main/java/org/eclipse/aether/internal/ant/AetherUtils.java
similarity index 94%
rename from src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java
rename to src/main/java/org/eclipse/aether/internal/ant/AetherUtils.java
index 16c4db4..e76ba08 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/AetherUtils.java
@@ -8,15 +8,14 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
-package org.eclipse.aether.internal.ant.util;
+package org.eclipse.aether.internal.ant;
import java.io.File;
import org.apache.tools.ant.Project;
-import org.eclipse.aether.internal.ant.Names;
import org.eclipse.aether.internal.ant.types.RemoteRepositories;
-public class AetherUtils
+class AetherUtils
{
public static File findGlobalSettings( Project project )
diff --git a/src/main/java/org/eclipse/aether/internal/ant/AntRepoSys.java b/src/main/java/org/eclipse/aether/internal/ant/AntRepoSys.java
index 860b203..76cc927 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/AntRepoSys.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/AntRepoSys.java
@@ -56,12 +56,19 @@
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.CollectResult;
import org.eclipse.aether.collection.DependencyCollectionException;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.deployment.DeployRequest;
+import org.eclipse.aether.deployment.DeploymentException;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.installation.InstallRequest;
+import org.eclipse.aether.installation.InstallationException;
+import org.eclipse.aether.internal.ant.types.Artifact;
+import org.eclipse.aether.internal.ant.types.Artifacts;
import org.eclipse.aether.internal.ant.types.Authentication;
import org.eclipse.aether.internal.ant.types.Dependencies;
import org.eclipse.aether.internal.ant.types.Dependency;
@@ -73,9 +80,6 @@
import org.eclipse.aether.internal.ant.types.Proxy;
import org.eclipse.aether.internal.ant.types.RemoteRepositories;
import org.eclipse.aether.internal.ant.types.RemoteRepository;
-import org.eclipse.aether.internal.ant.util.AetherUtils;
-import org.eclipse.aether.internal.ant.util.ConverterUtils;
-import org.eclipse.aether.internal.ant.util.SettingsUtils;
import org.eclipse.aether.repository.AuthenticationSelector;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.repository.MirrorSelector;
@@ -748,4 +752,65 @@
return dependencies;
}
+ public void install( Task task, Pom pom, Artifacts artifacts )
+ {
+ RepositorySystemSession session = getSession( task, null );
+
+ InstallRequest request = new InstallRequest();
+ request.setArtifacts( toArtifacts( task, session, pom, artifacts ) );
+
+ try
+ {
+ getSystem().install( session, request );
+ }
+ catch ( InstallationException e )
+ {
+ throw new BuildException( "Could not install artifacts: " + e.getMessage(), e );
+ }
+ }
+
+ public void deploy( Task task, Pom pom, Artifacts artifacts, RemoteRepository releaseRepository,
+ RemoteRepository snapshotRepository )
+ {
+ RepositorySystemSession session = getSession( task, null );
+
+ DeployRequest request = new DeployRequest();
+ request.setArtifacts( toArtifacts( task, session, pom, artifacts ) );
+ boolean snapshot = request.getArtifacts().iterator().next().isSnapshot();
+ RemoteRepository distRepo = ( snapshot && snapshotRepository != null ) ? snapshotRepository : releaseRepository;
+ request.setRepository( ConverterUtils.toDistRepository( distRepo, session ) );
+
+ try
+ {
+ getSystem().deploy( session, request );
+ }
+ catch ( DeploymentException e )
+ {
+ throw new BuildException( "Could not deploy artifacts: " + e.getMessage(), e );
+ }
+ }
+
+ private List<org.eclipse.aether.artifact.Artifact> toArtifacts( Task task, RepositorySystemSession session,
+ Pom pom, Artifacts artifacts )
+ {
+ Model model = pom.getModel( task );
+ File pomFile = pom.getFile();
+
+ List<org.eclipse.aether.artifact.Artifact> results = new ArrayList<org.eclipse.aether.artifact.Artifact>();
+
+ org.eclipse.aether.artifact.Artifact pomArtifact =
+ new DefaultArtifact( model.getGroupId(), model.getArtifactId(), "pom", model.getVersion() ).setFile( pomFile );
+ results.add( pomArtifact );
+
+ for ( Artifact artifact : artifacts.getArtifacts() )
+ {
+ org.eclipse.aether.artifact.Artifact buildArtifact =
+ new DefaultArtifact( model.getGroupId(), model.getArtifactId(), artifact.getClassifier(),
+ artifact.getType(), model.getVersion() ).setFile( artifact.getFile() );
+ results.add( buildArtifact );
+ }
+
+ return results;
+ }
+
}
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java b/src/main/java/org/eclipse/aether/internal/ant/ConverterUtils.java
similarity index 98%
rename from src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java
rename to src/main/java/org/eclipse/aether/internal/ant/ConverterUtils.java
index 3c604c4..79f994b 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/ConverterUtils.java
@@ -8,7 +8,7 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
-package org.eclipse.aether.internal.ant.util;
+package org.eclipse.aether.internal.ant;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,7 +39,7 @@
/**
* Utility methods to convert between Aether and Ant objects.
*/
-public class ConverterUtils
+class ConverterUtils
{
private static org.eclipse.aether.artifact.Artifact toArtifact( Dependency dependency, ArtifactTypeRegistry types )
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java b/src/main/java/org/eclipse/aether/internal/ant/SettingsUtils.java
similarity index 98%
rename from src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java
rename to src/main/java/org/eclipse/aether/internal/ant/SettingsUtils.java
index 5fe44bf..1d7314c 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/SettingsUtils.java
@@ -8,7 +8,7 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
-package org.eclipse.aether.internal.ant.util;
+package org.eclipse.aether.internal.ant;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +24,7 @@
/**
* Utility methods to read settings from Mavens settings.xml.
*/
-public class SettingsUtils
+class SettingsUtils
{
public static List<org.apache.maven.model.Profile> convert( List<Profile> profiles )
diff --git a/src/main/java/org/eclipse/aether/internal/ant/tasks/AbstractDistTask.java b/src/main/java/org/eclipse/aether/internal/ant/tasks/AbstractDistTask.java
index 215b6e6..1c0eccb 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/tasks/AbstractDistTask.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/tasks/AbstractDistTask.java
@@ -11,9 +11,7 @@
package org.eclipse.aether.internal.ant.tasks;
import java.io.File;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.maven.model.Model;
@@ -21,12 +19,10 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Reference;
-import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.internal.ant.AntRepoSys;
import org.eclipse.aether.internal.ant.types.Artifact;
import org.eclipse.aether.internal.ant.types.Artifacts;
import org.eclipse.aether.internal.ant.types.Pom;
-import org.eclipse.aether.RepositorySystemSession;
/**
*/
@@ -114,28 +110,6 @@
}
}
- protected List<org.eclipse.aether.artifact.Artifact> toArtifacts( RepositorySystemSession session )
- {
- Model model = getPom().getModel( this );
- File pomFile = getPom().getFile();
-
- List<org.eclipse.aether.artifact.Artifact> results = new ArrayList<org.eclipse.aether.artifact.Artifact>();
-
- org.eclipse.aether.artifact.Artifact pomArtifact =
- new DefaultArtifact( model.getGroupId(), model.getArtifactId(), "pom", model.getVersion() ).setFile( pomFile );
- results.add( pomArtifact );
-
- for ( Artifact artifact : getArtifacts().getArtifacts() )
- {
- org.eclipse.aether.artifact.Artifact buildArtifact =
- new DefaultArtifact( model.getGroupId(), model.getArtifactId(), artifact.getClassifier(),
- artifact.getType(), model.getVersion() ).setFile( artifact.getFile() );
- results.add( buildArtifact );
- }
-
- return results;
- }
-
protected Artifacts getArtifacts()
{
if ( artifacts == null )
diff --git a/src/main/java/org/eclipse/aether/internal/ant/tasks/Deploy.java b/src/main/java/org/eclipse/aether/internal/ant/tasks/Deploy.java
index fdf8a83..7f72919 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/tasks/Deploy.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/tasks/Deploy.java
@@ -12,13 +12,8 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.Reference;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.deployment.DeployRequest;
-import org.eclipse.aether.deployment.DeploymentException;
import org.eclipse.aether.internal.ant.AntRepoSys;
import org.eclipse.aether.internal.ant.types.RemoteRepository;
-import org.eclipse.aether.internal.ant.util.ConverterUtils;
/**
*/
@@ -94,27 +89,7 @@
{
validate();
- AntRepoSys sys = AntRepoSys.getInstance( getProject() );
-
- RepositorySystemSession session = sys.getSession( this, null );
- RepositorySystem system = sys.getSystem();
-
- DeployRequest request = new DeployRequest();
-
- request.setArtifacts( toArtifacts( session ) );
-
- boolean snapshot = request.getArtifacts().iterator().next().isSnapshot();
- RemoteRepository distRepo = ( snapshot && snapshotRepository != null ) ? snapshotRepository : repository;
- request.setRepository( ConverterUtils.toDistRepository( distRepo, session ) );
-
- try
- {
- system.deploy( session, request );
- }
- catch ( DeploymentException e )
- {
- throw new BuildException( "Could not deploy artifacts: " + e.getMessage(), e );
- }
+ AntRepoSys.getInstance( getProject() ).deploy( this, getPom(), getArtifacts(), repository, snapshotRepository );
}
}
diff --git a/src/main/java/org/eclipse/aether/internal/ant/tasks/Install.java b/src/main/java/org/eclipse/aether/internal/ant/tasks/Install.java
index 2029c8a..2a30359 100644
--- a/src/main/java/org/eclipse/aether/internal/ant/tasks/Install.java
+++ b/src/main/java/org/eclipse/aether/internal/ant/tasks/Install.java
@@ -11,10 +11,6 @@
package org.eclipse.aether.internal.ant.tasks;
import org.apache.tools.ant.BuildException;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.installation.InstallRequest;
-import org.eclipse.aether.installation.InstallationException;
import org.eclipse.aether.internal.ant.AntRepoSys;
/**
@@ -29,22 +25,7 @@
{
validate();
- AntRepoSys sys = AntRepoSys.getInstance( getProject() );
-
- RepositorySystemSession session = sys.getSession( this, null );
- RepositorySystem system = sys.getSystem();
-
- InstallRequest request = new InstallRequest();
- request.setArtifacts( toArtifacts( session ) );
-
- try
- {
- system.install( session, request );
- }
- catch ( InstallationException e )
- {
- throw new BuildException( "Could not install artifacts: " + e.getMessage(), e );
- }
+ AntRepoSys.getInstance( getProject() ).install( this, getPom(), getArtifacts() );
}
}