You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/05/07 13:30:21 UTC
[28/50] [abbrv] maven-aether git commit: Bug 433805 - Move all code
for Ant tasks into internal package
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/Pom.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/Pom.java b/src/main/java/org/eclipse/aether/internal/ant/types/Pom.java
new file mode 100644
index 0000000..5b30eba
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/Pom.java
@@ -0,0 +1,343 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import java.io.File;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.maven.model.Model;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Reference;
+import org.eclipse.aether.internal.ant.AntRepoSys;
+import org.eclipse.aether.internal.ant.ProjectWorkspaceReader;
+import org.eclipse.aether.internal.ant.tasks.RefTask;
+
+/**
+ */
+public class Pom
+ extends RefTask
+{
+
+ private Model model;
+
+ private String id;
+
+ private File file;
+
+ private String groupId;
+
+ private String artifactId;
+
+ private String version;
+
+ private String packaging = "jar";
+
+ private RemoteRepositories remoteRepositories;
+
+ private String coords;
+
+ protected Pom getRef()
+ {
+ return (Pom) getCheckedRef();
+ }
+
+ public void validate()
+ {
+ if ( isReference() )
+ {
+ getRef().validate();
+ }
+ else
+ {
+ if ( file == null )
+ {
+ if ( groupId == null )
+ {
+ throw new BuildException( "You must specify the 'groupId' for the POM" );
+ }
+ if ( artifactId == null )
+ {
+ throw new BuildException( "You must specify the 'artifactId' for the POM" );
+ }
+ if ( version == null )
+ {
+ throw new BuildException( "You must specify the 'version' for the POM" );
+ }
+ }
+ }
+
+ }
+
+ public void setRefid( Reference ref )
+ {
+ if ( id != null || file != null || groupId != null || artifactId != null || version != null )
+ {
+ throw tooManyAttributes();
+ }
+ if ( remoteRepositories != null )
+ {
+ throw noChildrenAllowed();
+ }
+ super.setRefid( ref );
+ }
+
+ public void setId( String id )
+ {
+ checkAttributesAllowed();
+ this.id = id;
+ }
+
+ public File getFile()
+ {
+ if ( isReference() )
+ {
+ return getRef().getFile();
+ }
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ checkAttributesAllowed();
+ if ( groupId != null || artifactId != null || version != null )
+ {
+ throw ambiguousSource();
+ }
+
+ this.file = file;
+
+ }
+
+ public String getGroupId()
+ {
+ if ( isReference() )
+ {
+ return getRef().getGroupId();
+ }
+ return groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ checkAttributesAllowed();
+ if ( this.groupId != null )
+ {
+ throw ambiguousCoords();
+ }
+ if ( file != null )
+ {
+ throw ambiguousSource();
+ }
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ if ( isReference() )
+ {
+ return getRef().getArtifactId();
+ }
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ checkAttributesAllowed();
+ if ( this.artifactId != null )
+ {
+ throw ambiguousCoords();
+ }
+ if ( file != null )
+ {
+ throw ambiguousSource();
+ }
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion()
+ {
+ if ( isReference() )
+ {
+ return getRef().getVersion();
+ }
+ return version;
+ }
+
+ public void setVersion( String version )
+ {
+ checkAttributesAllowed();
+ if ( this.version != null )
+ {
+ throw ambiguousCoords();
+ }
+ if ( file != null )
+ {
+ throw ambiguousSource();
+ }
+ this.version = version;
+ }
+
+ public String getCoords()
+ {
+ if ( isReference() )
+ {
+ return getRef().getCoords();
+ }
+ return coords;
+ }
+
+ public void setCoords( String coords )
+ {
+ checkAttributesAllowed();
+ if ( file != null )
+ {
+ throw ambiguousSource();
+ }
+ if ( groupId != null || artifactId != null || version != null )
+ {
+ throw ambiguousCoords();
+ }
+ Pattern p = Pattern.compile( "([^: ]+):([^: ]+):([^: ]+)" );
+ Matcher m = p.matcher( coords );
+ if ( !m.matches() )
+ {
+ throw new BuildException( "Bad POM coordinates, expected format is <groupId>:<artifactId>:<version>" );
+ }
+ groupId = m.group( 1 );
+ artifactId = m.group( 2 );
+ version = m.group( 3 );
+ }
+
+ private BuildException ambiguousCoords()
+ {
+ return new BuildException( "You must not specify both 'coords' and ('groupId', 'artifactId', 'version')" );
+ }
+
+ private BuildException ambiguousSource()
+ {
+ return new BuildException( "You must not specify both 'file' and "
+ + "('coords', 'groupId', 'artifactId', 'version')" );
+ }
+
+ public String getPackaging()
+ {
+ if ( isReference() )
+ {
+ return getRef().getPackaging();
+ }
+ return packaging;
+ }
+
+ public void setPackaging( String packaging )
+ {
+ checkAttributesAllowed();
+ if ( file != null )
+ {
+ throw ambiguousSource();
+ }
+ this.packaging = packaging;
+ }
+
+ private RemoteRepositories getRemoteRepos()
+ {
+ if ( remoteRepositories == null )
+ {
+ remoteRepositories = new RemoteRepositories();
+ remoteRepositories.setProject( getProject() );
+ }
+ return remoteRepositories;
+ }
+
+ public void addRemoteRepo( RemoteRepository repository )
+ {
+ getRemoteRepos().addRemoterepo( repository );
+ }
+
+ public void addRemoteRepos( RemoteRepositories repositories )
+ {
+ getRemoteRepos().addRemoterepos( repositories );
+ }
+
+ public void setRemoteReposRef( Reference ref )
+ {
+ RemoteRepositories repos = new RemoteRepositories();
+ repos.setProject( getProject() );
+ repos.setRefid( ref );
+ getRemoteRepos().addRemoterepos( repos );
+ }
+
+ public Model getModel( Task task )
+ {
+ if ( isReference() )
+ {
+ return getRef().getModel( task );
+ }
+ synchronized ( this )
+ {
+ if ( model == null )
+ {
+ if ( file != null )
+ {
+ model = AntRepoSys.getInstance( getProject() ).loadModel( task, file, true, remoteRepositories );
+ }
+ }
+ return model;
+ }
+ }
+
+ @Override
+ public void execute()
+ {
+ validate();
+
+ if ( file != null && ( id == null || AntRepoSys.getInstance( getProject() ).getDefaultPom() == null ) )
+ {
+ AntRepoSys.getInstance( getProject() ).setDefaultPom( this );
+ }
+
+ ProjectWorkspaceReader.getInstance().addPom( this );
+
+ Model model = getModel( this );
+
+ if ( model == null )
+ {
+ coords = getGroupId() + ":" + getArtifactId() + ":" + getVersion();
+ return;
+ }
+
+ coords = model.getGroupId() + ":" + model.getArtifactId() + ":" + model.getVersion();
+
+ ModelValueExtractor extractor = new ModelValueExtractor( id, model, getProject() );
+
+ PropertyHelper propHelper = PropertyHelper.getPropertyHelper( getProject() );
+
+ try
+ {
+ // Ant 1.8.0 delegate
+ PomPropertyEvaluator.register( extractor, propHelper );
+ }
+ catch ( LinkageError e )
+ {
+ // Ant 1.6 - 1.7.1 interceptor chaining
+ PomPropertyHelper.register( extractor, propHelper );
+ }
+
+ }
+
+ public String toString()
+ {
+ return coords + " (" + super.toString() + ")";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyEvaluator.java b/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyEvaluator.java
new file mode 100644
index 0000000..234149c
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyEvaluator.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.PropertyHelper.PropertyEvaluator;
+import org.apache.tools.ant.property.NullReturn;
+
+/**
+ */
+class PomPropertyEvaluator
+ implements PropertyEvaluator
+{
+
+ private final ModelValueExtractor extractor;
+
+ public static void register( ModelValueExtractor extractor, PropertyHelper propertyHelper )
+ {
+ propertyHelper.add( new PomPropertyEvaluator( extractor ) );
+ }
+
+ private PomPropertyEvaluator( ModelValueExtractor extractor )
+ {
+ if ( extractor == null )
+ {
+ throw new IllegalArgumentException( "no model value exractor specified" );
+ }
+ this.extractor = extractor;
+ }
+
+ public Object evaluate( String property, PropertyHelper propertyHelper )
+ {
+ Object value = extractor.getValue( property );
+ if ( value != null )
+ {
+ return value;
+ }
+ else if ( extractor.isApplicable( property ) )
+ {
+ return NullReturn.NULL;
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyHelper.java b/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyHelper.java
new file mode 100644
index 0000000..a22b10d
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/PomPropertyHelper.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import org.apache.tools.ant.PropertyHelper;
+
+/**
+ */
+@SuppressWarnings( "deprecation" )
+class PomPropertyHelper
+ extends PropertyHelper
+{
+
+ private final ModelValueExtractor extractor;
+
+ public static void register( ModelValueExtractor extractor, PropertyHelper propertyHelper )
+ {
+ PomPropertyHelper helper = new PomPropertyHelper( extractor );
+ helper.setNext( propertyHelper.getNext() );
+ propertyHelper.setNext( helper );
+ }
+
+ public PomPropertyHelper( ModelValueExtractor extractor )
+ {
+ if ( extractor == null )
+ {
+ throw new IllegalArgumentException( "no model value exractor specified" );
+ }
+ this.extractor = extractor;
+ setProject( extractor.getProject() );
+ }
+
+ @Override
+ public Object getPropertyHook( String ns, String name, boolean user )
+ {
+ Object value = extractor.getValue( name );
+ if ( value != null )
+ {
+ return value;
+ }
+ else if ( extractor.isApplicable( name ) )
+ {
+ return null;
+ }
+ return super.getPropertyHook( ns, name, user );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/Proxy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/Proxy.java b/src/main/java/org/eclipse/aether/internal/ant/types/Proxy.java
new file mode 100644
index 0000000..7203a25
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/Proxy.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Reference;
+import org.eclipse.aether.internal.ant.AntRepoSys;
+
+/**
+ */
+public class Proxy
+ extends DataType
+{
+
+ private String host;
+
+ private int port;
+
+ private String type;
+
+ private String nonProxyHosts;
+
+ private Authentication authentication;
+
+ @Override
+ public void setProject( Project project )
+ {
+ super.setProject( project );
+
+ AntRepoSys.getInstance( project ).addProxy( this );
+ }
+
+ protected Proxy getRef()
+ {
+ return (Proxy) getCheckedRef();
+ }
+
+ public void setRefid( Reference ref )
+ {
+ if ( host != null || port != 0 || type != null || nonProxyHosts != null )
+ {
+ throw tooManyAttributes();
+ }
+ if ( authentication != null )
+ {
+ throw noChildrenAllowed();
+ }
+ super.setRefid( ref );
+ }
+
+ public String getHost()
+ {
+ if ( isReference() )
+ {
+ return getRef().getHost();
+ }
+ return host;
+ }
+
+ public void setHost( String host )
+ {
+ checkAttributesAllowed();
+ this.host = host;
+ }
+
+ public int getPort()
+ {
+ if ( isReference() )
+ {
+ return getRef().getPort();
+ }
+ return port;
+ }
+
+ public void setPort( int port )
+ {
+ checkAttributesAllowed();
+ if ( port <= 0 || port > 0xFFFF )
+ {
+ throw new BuildException( "The port number must be within the range 1 - 65535" );
+ }
+ this.port = port;
+ }
+
+ public String getType()
+ {
+ if ( isReference() )
+ {
+ return getRef().getType();
+ }
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ checkAttributesAllowed();
+ this.type = type;
+ }
+
+ public String getNonProxyHosts()
+ {
+ if ( isReference() )
+ {
+ return getRef().getNonProxyHosts();
+ }
+ return nonProxyHosts;
+ }
+
+ public void setNonProxyHosts( String nonProxyHosts )
+ {
+ checkAttributesAllowed();
+ this.nonProxyHosts = nonProxyHosts;
+ }
+
+ public Authentication getAuthentication()
+ {
+ if ( isReference() )
+ {
+ return getRef().getAuthentication();
+ }
+ return authentication;
+ }
+
+ public void addAuthentication( Authentication authentication )
+ {
+ checkChildrenAllowed();
+ if ( this.authentication != null )
+ {
+ throw new BuildException( "You must not specify multiple <authentication> elements" );
+ }
+ this.authentication = authentication;
+ }
+
+ public void setAuthRef( Reference ref )
+ {
+ if ( authentication == null )
+ {
+ authentication = new Authentication();
+ authentication.setProject( getProject() );
+ }
+ authentication.setRefid( ref );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositories.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositories.java b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositories.java
new file mode 100644
index 0000000..17d4cbe
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositories.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ */
+public class RemoteRepositories
+ extends DataType
+ implements RemoteRepositoryContainer
+{
+
+ private List<RemoteRepositoryContainer> containers = new ArrayList<RemoteRepositoryContainer>();
+
+ protected RemoteRepositories getRef()
+ {
+ return (RemoteRepositories) getCheckedRef();
+ }
+
+ public void validate( Task task )
+ {
+ if ( isReference() )
+ {
+ getRef().validate( task );
+ }
+ else
+ {
+ for ( RemoteRepositoryContainer container : containers )
+ {
+ container.validate( task );
+ }
+ }
+ }
+
+ public void setRefid( Reference ref )
+ {
+ if ( !containers.isEmpty() )
+ {
+ throw noChildrenAllowed();
+ }
+ super.setRefid( ref );
+ }
+
+ public void addRemoterepo( RemoteRepository repository )
+ {
+ checkChildrenAllowed();
+ containers.add( repository );
+ }
+
+ public void addRemoterepos( RemoteRepositories repositories )
+ {
+ checkChildrenAllowed();
+ if ( repositories == this )
+ {
+ throw circularReference();
+ }
+ containers.add( repositories );
+ }
+
+ public List<RemoteRepository> getRepositories()
+ {
+ if ( isReference() )
+ {
+ return getRef().getRepositories();
+ }
+ List<RemoteRepository> repos = new ArrayList<RemoteRepository>();
+ for ( RemoteRepositoryContainer container : containers )
+ {
+ repos.addAll( container.getRepositories() );
+ }
+ return repos;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepository.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepository.java b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepository.java
new file mode 100644
index 0000000..b4857a7
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepository.java
@@ -0,0 +1,340 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Reference;
+import org.eclipse.aether.internal.ant.AntRepoSys;
+import org.eclipse.aether.repository.RepositoryPolicy;
+
+/**
+ */
+public class RemoteRepository
+ extends DataType
+ implements RemoteRepositoryContainer
+{
+
+ private String id;
+
+ private String url;
+
+ private String type;
+
+ private Policy releasePolicy;
+
+ private Policy snapshotPolicy;
+
+ private boolean releases = true;
+
+ private boolean snapshots = false;
+
+ private String checksums;
+
+ private String updates;
+
+ private Authentication authentication;
+
+ @Override
+ public void setProject( Project project )
+ {
+ super.setProject( project );
+
+ // NOTE: Just trigger side-effect of default initialization before this type potentially overrides central
+ AntRepoSys.getInstance( project );
+ }
+
+ protected RemoteRepository getRef()
+ {
+ return (RemoteRepository) getCheckedRef();
+ }
+
+ public void validate( Task task )
+ {
+ if ( isReference() )
+ {
+ getRef().validate( task );
+ }
+ else
+ {
+ if ( url == null || url.length() <= 0 )
+ {
+ throw new BuildException( "You must specify the 'url' for a remote repository" );
+ }
+ if ( id == null || id.length() <= 0 )
+ {
+ throw new BuildException( "You must specify the 'id' for a remote repository" );
+ }
+ }
+ }
+
+ public void setRefid( Reference ref )
+ {
+ if ( id != null || url != null || type != null || checksums != null || updates != null )
+ {
+ throw tooManyAttributes();
+ }
+ if ( releasePolicy != null || snapshotPolicy != null || authentication != null )
+ {
+ throw noChildrenAllowed();
+ }
+ super.setRefid( ref );
+ }
+
+ public String getId()
+ {
+ if ( isReference() )
+ {
+ return getRef().getId();
+ }
+ return id;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ public String getUrl()
+ {
+ if ( isReference() )
+ {
+ return getRef().getUrl();
+ }
+ return url;
+ }
+
+ public void setUrl( String url )
+ {
+ checkAttributesAllowed();
+ this.url = url;
+ }
+
+ public String getType()
+ {
+ if ( isReference() )
+ {
+ return getRef().getType();
+ }
+ return ( type != null ) ? type : "default";
+ }
+
+ public void setType( String type )
+ {
+ checkAttributesAllowed();
+ this.type = type;
+ }
+
+ public Policy getReleasePolicy()
+ {
+ if ( isReference() )
+ {
+ return getRef().getReleasePolicy();
+ }
+ return releasePolicy;
+ }
+
+ public void addReleases( Policy policy )
+ {
+ checkChildrenAllowed();
+ if ( this.releasePolicy != null )
+ {
+ throw new BuildException( "You must not specify multiple <releases> elements" );
+ }
+ this.releasePolicy = policy;
+ }
+
+ public Policy getSnapshotPolicy()
+ {
+ if ( isReference() )
+ {
+ return getRef().getSnapshotPolicy();
+ }
+ return snapshotPolicy;
+ }
+
+ public void addSnapshots( Policy policy )
+ {
+ checkChildrenAllowed();
+ if ( this.snapshotPolicy != null )
+ {
+ throw new BuildException( "You must not specify multiple <snapshots> elements" );
+ }
+ this.snapshotPolicy = policy;
+ }
+
+ public boolean isReleases()
+ {
+ if ( isReference() )
+ {
+ return getRef().isReleases();
+ }
+ return releases;
+ }
+
+ public void setReleases( boolean releases )
+ {
+ checkAttributesAllowed();
+ this.releases = releases;
+ }
+
+ public boolean isSnapshots()
+ {
+ if ( isReference() )
+ {
+ return getRef().isSnapshots();
+ }
+ return snapshots;
+ }
+
+ public void setSnapshots( boolean snapshots )
+ {
+ checkAttributesAllowed();
+ this.snapshots = snapshots;
+ }
+
+ public String getUpdates()
+ {
+ if ( isReference() )
+ {
+ return getRef().getUpdates();
+ }
+ return ( updates != null ) ? updates : RepositoryPolicy.UPDATE_POLICY_DAILY;
+ }
+
+ public void setUpdates( String updates )
+ {
+ checkAttributesAllowed();
+ checkUpdates( updates );
+ this.updates = updates;
+ }
+
+ protected static void checkUpdates( String updates )
+ {
+ if ( !RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( updates )
+ && !RepositoryPolicy.UPDATE_POLICY_DAILY.equals( updates )
+ && !RepositoryPolicy.UPDATE_POLICY_NEVER.equals( updates )
+ && !updates.startsWith( RepositoryPolicy.UPDATE_POLICY_INTERVAL ) )
+ {
+ throw new BuildException( "'" + updates + "' is not a permitted update policy" );
+ }
+ }
+
+ public String getChecksums()
+ {
+ if ( isReference() )
+ {
+ return getRef().getChecksums();
+ }
+ return ( checksums != null ) ? checksums : RepositoryPolicy.CHECKSUM_POLICY_WARN;
+ }
+
+ public void setChecksums( String checksums )
+ {
+ checkAttributesAllowed();
+ checkChecksums( checksums );
+ this.checksums = checksums;
+ }
+
+ protected static void checkChecksums( String checksums )
+ {
+ if ( !RepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksums )
+ && !RepositoryPolicy.CHECKSUM_POLICY_WARN.equals( checksums )
+ && !RepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksums ) )
+ {
+ throw new BuildException( "'" + checksums + "' is not a permitted checksum policy" );
+ }
+ }
+
+ public Authentication getAuthentication()
+ {
+ if ( isReference() )
+ {
+ return getRef().getAuthentication();
+ }
+ return authentication;
+ }
+
+ public void addAuthentication( Authentication authentication )
+ {
+ checkChildrenAllowed();
+ if ( this.authentication != null )
+ {
+ throw new BuildException( "You must not specify multiple <authentication> elements" );
+ }
+ this.authentication = authentication;
+ }
+
+ public void setAuthRef( Reference ref )
+ {
+ checkAttributesAllowed();
+ if ( authentication == null )
+ {
+ authentication = new Authentication();
+ authentication.setProject( getProject() );
+ }
+ authentication.setRefid( ref );
+ }
+
+ public List<RemoteRepository> getRepositories()
+ {
+ return Collections.singletonList( this );
+ }
+
+ public static class Policy
+ {
+
+ private boolean enabled = true;
+
+ private String checksumPolicy;
+
+ private String updatePolicy;
+
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ public void setEnabled( boolean enabled )
+ {
+ this.enabled = enabled;
+ }
+
+ public String getChecksums()
+ {
+ return checksumPolicy;
+ }
+
+ public void setChecksums( String checksumPolicy )
+ {
+ checkChecksums( checksumPolicy );
+ this.checksumPolicy = checksumPolicy;
+ }
+
+ public String getUpdates()
+ {
+ return updatePolicy;
+ }
+
+ public void setUpdates( String updatePolicy )
+ {
+ checkUpdates( updatePolicy );
+ this.updatePolicy = updatePolicy;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositoryContainer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositoryContainer.java b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositoryContainer.java
new file mode 100644
index 0000000..dd958d9
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/RemoteRepositoryContainer.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import java.util.List;
+
+import org.apache.tools.ant.Task;
+
+/**
+ */
+public interface RemoteRepositoryContainer
+{
+
+ void validate( Task task );
+
+ List<RemoteRepository> getRepositories();
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/types/Settings.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/types/Settings.java b/src/main/java/org/eclipse/aether/internal/ant/types/Settings.java
new file mode 100644
index 0000000..9723c96
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/types/Settings.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.types;
+
+import java.io.File;
+
+import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Reference;
+import org.eclipse.aether.internal.ant.AntRepoSys;
+
+/**
+ */
+public class Settings
+ extends DataType
+{
+
+ private File file;
+
+ private File globalFile;
+
+ protected Settings getRef()
+ {
+ return (Settings) getCheckedRef();
+ }
+
+ public void setRefid( Reference ref )
+ {
+ if ( file != null || globalFile != null )
+ {
+ throw tooManyAttributes();
+ }
+ super.setRefid( ref );
+ }
+
+ public File getFile()
+ {
+ if ( isReference() )
+ {
+ return getRef().getFile();
+ }
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ checkAttributesAllowed();
+ this.file = file;
+
+ AntRepoSys.getInstance( getProject() ).setUserSettings( file );
+ }
+
+ public File getGlobalFile()
+ {
+ if ( isReference() )
+ {
+ return getRef().getFile();
+ }
+ return globalFile;
+ }
+
+ public void setGlobalFile( File globalFile )
+ {
+ checkAttributesAllowed();
+ this.globalFile = globalFile;
+
+ AntRepoSys.getInstance( getProject() ).setGlobalSettings( globalFile );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java b/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java
new file mode 100644
index 0000000..16c4db4
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/util/AetherUtils.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.util;
+
+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
+{
+
+ public static File findGlobalSettings( Project project )
+ {
+ File file = new File( new File( project.getProperty( "ant.home" ), "etc" ), Names.SETTINGS_XML );
+ if ( file.isFile() )
+ {
+ return file;
+ }
+ else
+ {
+ String mavenHome = getMavenHome( project );
+ if ( mavenHome != null )
+ {
+ return new File( new File( mavenHome, "conf" ), Names.SETTINGS_XML );
+ }
+ }
+
+ return null;
+ }
+
+ public static String getMavenHome( Project project )
+ {
+ String mavenHome = project.getProperty( "maven.home" );
+ if ( mavenHome != null )
+ {
+ return mavenHome;
+ }
+ return System.getenv( "M2_HOME" );
+ }
+
+ public static File findUserSettings( Project project )
+ {
+ File userHome = new File( project.getProperty( "user.home" ) );
+ File file = new File( new File( userHome, ".ant" ), Names.SETTINGS_XML );
+ if ( file.isFile() )
+ {
+ return file;
+ }
+ else
+ {
+ return new File( new File( userHome, ".m2" ), Names.SETTINGS_XML );
+ }
+ }
+
+ public static RemoteRepositories getDefaultRepositories( Project project )
+ {
+ Object obj = project.getReference( Names.ID_DEFAULT_REPOS );
+ if ( obj instanceof RemoteRepositories )
+ {
+ return (RemoteRepositories) obj;
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java b/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java
new file mode 100644
index 0000000..3c604c4
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/util/ConverterUtils.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.tools.ant.Project;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.ArtifactProperties;
+import org.eclipse.aether.artifact.ArtifactType;
+import org.eclipse.aether.artifact.ArtifactTypeRegistry;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.DefaultArtifactType;
+import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.internal.ant.types.Authentication;
+import org.eclipse.aether.internal.ant.types.Dependency;
+import org.eclipse.aether.internal.ant.types.Exclusion;
+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.repository.RepositoryPolicy;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
+
+/**
+ * Utility methods to convert between Aether and Ant objects.
+ */
+public class ConverterUtils
+{
+
+ private static org.eclipse.aether.artifact.Artifact toArtifact( Dependency dependency, ArtifactTypeRegistry types )
+ {
+ ArtifactType type = types.get( dependency.getType() );
+ if ( type == null )
+ {
+ type = new DefaultArtifactType( dependency.getType() );
+ }
+
+ Map<String, String> props = null;
+ if ( "system".equals( dependency.getScope() ) && dependency.getSystemPath() != null )
+ {
+ props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath().getPath() );
+ }
+
+ Artifact artifact =
+ new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
+ dependency.getVersion(), props, type );
+
+ return artifact;
+ }
+
+ public static org.eclipse.aether.repository.Authentication toAuthentication( Authentication auth )
+ {
+ if ( auth == null )
+ {
+ return null;
+ }
+ AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+ authBuilder.addUsername( auth.getUsername() ).addPassword( auth.getPassword() );
+ authBuilder.addPrivateKey( auth.getPrivateKeyFile(), auth.getPassphrase() );
+ return authBuilder.build();
+ }
+
+ public static org.eclipse.aether.graph.Dependency toDependency( Dependency dependency, List<Exclusion> exclusions,
+ RepositorySystemSession session )
+ {
+ return new org.eclipse.aether.graph.Dependency( toArtifact( dependency, session.getArtifactTypeRegistry() ),
+ dependency.getScope(), false,
+ toExclusions( dependency.getExclusions(), exclusions ) );
+ }
+
+ /**
+ * Converts the given ant repository type to an Aether repository instance with authentication and proxy filled in
+ * via the sessions' selectors.
+ */
+ public static org.eclipse.aether.repository.RemoteRepository toDistRepository( RemoteRepository repo,
+ RepositorySystemSession session )
+ {
+ org.eclipse.aether.repository.RemoteRepository result = toRepository( repo );
+ org.eclipse.aether.repository.RemoteRepository.Builder builder =
+ new org.eclipse.aether.repository.RemoteRepository.Builder( result );
+ builder.setAuthentication( session.getAuthenticationSelector().getAuthentication( result ) );
+ builder.setProxy( session.getProxySelector().getProxy( result ) );
+ return builder.build();
+ }
+
+ private static org.eclipse.aether.graph.Exclusion toExclusion( Exclusion exclusion )
+ {
+ return new org.eclipse.aether.graph.Exclusion( exclusion.getGroupId(), exclusion.getArtifactId(),
+ exclusion.getClassifier(), exclusion.getExtension() );
+ }
+
+ private static Collection<org.eclipse.aether.graph.Exclusion> toExclusions( Collection<Exclusion> exclusions1,
+ Collection<Exclusion> exclusions2 )
+ {
+ Collection<org.eclipse.aether.graph.Exclusion> results =
+ new LinkedHashSet<org.eclipse.aether.graph.Exclusion>();
+ if ( exclusions1 != null )
+ {
+ for ( Exclusion exclusion : exclusions1 )
+ {
+ results.add( toExclusion( exclusion ) );
+ }
+ }
+ if ( exclusions2 != null )
+ {
+ for ( Exclusion exclusion : exclusions2 )
+ {
+ results.add( toExclusion( exclusion ) );
+ }
+ }
+ return results;
+ }
+
+ private static RepositoryPolicy toPolicy( RemoteRepository.Policy policy, boolean enabled, String updates,
+ String checksums )
+ {
+ if ( policy != null )
+ {
+ enabled = policy.isEnabled();
+ if ( policy.getChecksums() != null )
+ {
+ checksums = policy.getChecksums();
+ }
+ if ( policy.getUpdates() != null )
+ {
+ updates = policy.getUpdates();
+ }
+ }
+ return new RepositoryPolicy( enabled, updates, checksums );
+ }
+
+ /**
+ * Adds every <String, String>-entry in the map as a property to the given Properties.
+ */
+ public static Properties addProperties( Properties props, Map<?, ?> map )
+ {
+ if ( props == null )
+ {
+ props = new Properties();
+ }
+ for ( Map.Entry<?, ?> entry : map.entrySet() )
+ {
+ if ( entry.getKey() instanceof String && entry.getValue() instanceof String )
+ {
+ props.put( entry.getKey(), entry.getValue() );
+ }
+ }
+ return props;
+ }
+
+ public static org.eclipse.aether.repository.Proxy toProxy( Proxy proxy )
+ {
+ if ( proxy == null )
+ {
+ return null;
+ }
+ return new org.eclipse.aether.repository.Proxy( proxy.getType(), proxy.getHost(), proxy.getPort(),
+ toAuthentication( proxy.getAuthentication() ) );
+ }
+
+ private static org.eclipse.aether.repository.RemoteRepository toRepository( RemoteRepository repo )
+ {
+ org.eclipse.aether.repository.RemoteRepository.Builder builder =
+ new org.eclipse.aether.repository.RemoteRepository.Builder( repo.getId(), repo.getType(), repo.getUrl() );
+ builder.setSnapshotPolicy( toPolicy( repo.getSnapshotPolicy(), repo.isSnapshots(), repo.getUpdates(),
+ repo.getChecksums() ) );
+ builder.setReleasePolicy( toPolicy( repo.getReleasePolicy(), repo.isReleases(), repo.getUpdates(),
+ repo.getChecksums() ) );
+ builder.setAuthentication( toAuthentication( repo.getAuthentication() ) );
+ return builder.build();
+ }
+
+ public static List<org.eclipse.aether.repository.RemoteRepository> toRepositories( Project project,
+ RepositorySystemSession session,
+ RemoteRepositories repos, RemoteRepositoryManager remoteRepositoryManager )
+ {
+ List<RemoteRepository> repositories;
+
+ if ( repos != null )
+ {
+ repositories = repos.getRepositories();
+ }
+ else
+ {
+ repositories = new ArrayList<RemoteRepository>();
+ }
+
+ List<org.eclipse.aether.repository.RemoteRepository> results =
+ new ArrayList<org.eclipse.aether.repository.RemoteRepository>();
+ for ( RemoteRepository repo : repositories )
+ {
+ results.add( toRepository( repo ) );
+ }
+
+ results =
+ remoteRepositoryManager.aggregateRepositories( session,
+ Collections.<org.eclipse.aether.repository.RemoteRepository> emptyList(),
+ results, true );
+
+ return results;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java b/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java
new file mode 100644
index 0000000..5fe44bf
--- /dev/null
+++ b/src/main/java/org/eclipse/aether/internal/ant/util/SettingsUtils.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.aether.internal.ant.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.settings.Activation;
+import org.apache.maven.settings.ActivationFile;
+import org.apache.maven.settings.ActivationOS;
+import org.apache.maven.settings.ActivationProperty;
+import org.apache.maven.settings.Profile;
+import org.apache.maven.settings.Repository;
+import org.apache.maven.settings.RepositoryPolicy;
+
+/**
+ * Utility methods to read settings from Mavens settings.xml.
+ */
+public class SettingsUtils
+{
+
+ public static List<org.apache.maven.model.Profile> convert( List<Profile> profiles )
+ {
+ if ( profiles == null )
+ {
+ return null;
+ }
+
+ List<org.apache.maven.model.Profile> results = new ArrayList<org.apache.maven.model.Profile>();
+
+ for ( Profile profile : profiles )
+ {
+ results.add( convert( profile ) );
+ }
+
+ return results;
+ }
+
+ static org.apache.maven.model.Profile convert( Profile profile )
+ {
+ if ( profile == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.Profile result = new org.apache.maven.model.Profile();
+
+ result.setId( profile.getId() );
+ result.setProperties( profile.getProperties() );
+ result.setSource( "settings.xml" );
+ result.setActivation( convert( profile.getActivation() ) );
+
+ for ( Repository repo : profile.getRepositories() )
+ {
+ result.addRepository( convert( repo ) );
+ }
+
+ for ( Repository repo : profile.getPluginRepositories() )
+ {
+ result.addPluginRepository( convert( repo ) );
+ }
+
+ return result;
+ }
+
+ static org.apache.maven.model.Activation convert( Activation activation )
+ {
+ if ( activation == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.Activation result = new org.apache.maven.model.Activation();
+
+ result.setActiveByDefault( activation.isActiveByDefault() );
+ result.setJdk( activation.getJdk() );
+ result.setFile( convert( activation.getFile() ) );
+ result.setProperty( convert( activation.getProperty() ) );
+ result.setOs( convert( activation.getOs() ) );
+
+ return result;
+ }
+
+ static org.apache.maven.model.ActivationOS convert( ActivationOS activation )
+ {
+ if ( activation == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.ActivationOS result = new org.apache.maven.model.ActivationOS();
+
+ result.setArch( activation.getArch() );
+ result.setFamily( activation.getFamily() );
+ result.setName( activation.getName() );
+ result.setVersion( activation.getVersion() );
+
+ return result;
+ }
+
+ static org.apache.maven.model.ActivationProperty convert( ActivationProperty activation )
+ {
+ if ( activation == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.ActivationProperty result = new org.apache.maven.model.ActivationProperty();
+
+ result.setName( activation.getName() );
+ result.setValue( activation.getValue() );
+
+ return result;
+ }
+
+ static org.apache.maven.model.ActivationFile convert( ActivationFile activation )
+ {
+ if ( activation == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.ActivationFile result = new org.apache.maven.model.ActivationFile();
+
+ result.setExists( activation.getExists() );
+ result.setMissing( activation.getMissing() );
+
+ return result;
+ }
+
+ static org.apache.maven.model.Repository convert( Repository repo )
+ {
+ if ( repo == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.Repository result = new org.apache.maven.model.Repository();
+
+ result.setId( repo.getId() );
+ result.setUrl( repo.getUrl() );
+ result.setLayout( repo.getLayout() );
+ result.setReleases( convert( repo.getReleases() ) );
+ result.setSnapshots( convert( repo.getSnapshots() ) );
+
+ return result;
+ }
+
+ static org.apache.maven.model.RepositoryPolicy convert( RepositoryPolicy policy )
+ {
+ if ( policy == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.model.RepositoryPolicy result = new org.apache.maven.model.RepositoryPolicy();
+
+ result.setEnabled( policy.isEnabled() );
+ result.setChecksumPolicy( policy.getChecksumPolicy() );
+ result.setUpdatePolicy( policy.getUpdatePolicy() );
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/main/resources/org/eclipse/aether/ant/antlib.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/eclipse/aether/ant/antlib.xml b/src/main/resources/org/eclipse/aether/ant/antlib.xml
index b20a7cb..326c461 100644
--- a/src/main/resources/org/eclipse/aether/ant/antlib.xml
+++ b/src/main/resources/org/eclipse/aether/ant/antlib.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright (c) 2010, 2011 Sonatype, Inc.
+ ~ Copyright (c) 2010, 2014 Sonatype, Inc.
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ which accompanies this distribution, and is available at
@@ -13,21 +13,21 @@
<antlib>
- <typedef name="authentication" classname="org.eclipse.aether.ant.types.Authentication"/>
- <typedef name="proxy" classname="org.eclipse.aether.ant.types.Proxy"/>
- <typedef name="mirror" classname="org.eclipse.aether.ant.types.Mirror"/>
- <typedef name="localrepo" classname="org.eclipse.aether.ant.types.LocalRepository"/>
- <typedef name="remoterepo" classname="org.eclipse.aether.ant.types.RemoteRepository"/>
- <typedef name="remoterepos" classname="org.eclipse.aether.ant.types.RemoteRepositories"/>
- <typedef name="dependency" classname="org.eclipse.aether.ant.types.Dependency"/>
- <typedef name="dependencies" classname="org.eclipse.aether.ant.types.Dependencies"/>
- <typedef name="artifact" classname="org.eclipse.aether.ant.types.Artifact"/>
- <typedef name="artifacts" classname="org.eclipse.aether.ant.types.Artifacts"/>
- <typedef name="settings" classname="org.eclipse.aether.ant.types.Settings"/>
+ <typedef name="authentication" classname="org.eclipse.aether.internal.ant.types.Authentication"/>
+ <typedef name="proxy" classname="org.eclipse.aether.internal.ant.types.Proxy"/>
+ <typedef name="mirror" classname="org.eclipse.aether.internal.ant.types.Mirror"/>
+ <typedef name="localrepo" classname="org.eclipse.aether.internal.ant.types.LocalRepository"/>
+ <typedef name="remoterepo" classname="org.eclipse.aether.internal.ant.types.RemoteRepository"/>
+ <typedef name="remoterepos" classname="org.eclipse.aether.internal.ant.types.RemoteRepositories"/>
+ <typedef name="dependency" classname="org.eclipse.aether.internal.ant.types.Dependency"/>
+ <typedef name="dependencies" classname="org.eclipse.aether.internal.ant.types.Dependencies"/>
+ <typedef name="artifact" classname="org.eclipse.aether.internal.ant.types.Artifact"/>
+ <typedef name="artifacts" classname="org.eclipse.aether.internal.ant.types.Artifacts"/>
+ <typedef name="settings" classname="org.eclipse.aether.internal.ant.types.Settings"/>
- <taskdef name="resolve" classname="org.eclipse.aether.ant.tasks.Resolve"/>
- <taskdef name="install" classname="org.eclipse.aether.ant.tasks.Install"/>
- <taskdef name="deploy" classname="org.eclipse.aether.ant.tasks.Deploy"/>
- <taskdef name="pom" classname="org.eclipse.aether.ant.types.Pom"/>
+ <taskdef name="resolve" classname="org.eclipse.aether.internal.ant.tasks.Resolve"/>
+ <taskdef name="install" classname="org.eclipse.aether.internal.ant.tasks.Install"/>
+ <taskdef name="deploy" classname="org.eclipse.aether.internal.ant.tasks.Deploy"/>
+ <taskdef name="pom" classname="org.eclipse.aether.internal.ant.types.Pom"/>
</antlib>
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/AntBuildsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/AntBuildsTest.java b/src/test/java/org/eclipse/aether/ant/AntBuildsTest.java
deleted file mode 100644
index d7916a9..0000000
--- a/src/test/java/org/eclipse/aether/ant/AntBuildsTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import java.io.File;
-import java.io.PrintStream;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileTest;
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.Project;
-import org.eclipse.aether.internal.test.util.TestFileUtils;
-
-public abstract class AntBuildsTest
- extends BuildFileTest
-{
-
- private static final File BASE_DIR;
-
- protected static final File BUILD_DIR;
-
- static
- {
- BASE_DIR = new File( "" ).getAbsoluteFile();
- BUILD_DIR = new File( BASE_DIR, "target/ant" );
- }
-
- protected File projectDir;
-
- protected File localRepoDir;
-
- protected File distRepoDir;
-
- protected String getProjectDirName()
- {
- String name = getClass().getSimpleName();
- if ( name.endsWith( "Test" ) )
- {
- name = name.substring( 0, name.length() - 4 );
- }
- return name;
- }
-
- protected void setUpProperties()
- throws Exception
- {
- // hook for subclasses to set further system properties for the project to pick up
- }
-
- @Override
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- TestFileUtils.deleteFile( BUILD_DIR );
-
- projectDir = new File( new File( BASE_DIR, "src/test/resources/ant" ), getProjectDirName() );
- localRepoDir = new File( BUILD_DIR, "local-repo" );
- distRepoDir = new File( BUILD_DIR, "dist-repo" );
-
- System.setProperty( "project.dir", projectDir.getAbsolutePath() );
- System.setProperty( "build.dir", BUILD_DIR.getAbsolutePath() );
- System.setProperty( "maven.repo.local", localRepoDir.getAbsolutePath() );
- System.setProperty( "project.distrepo.url", distRepoDir.toURI().toString() );
- setUpProperties();
-
- configureProject( new File( projectDir, "ant.xml" ).getAbsolutePath(), Project.MSG_VERBOSE );
- }
-
- @Override
- protected void tearDown()
- throws Exception
- {
- try
- {
- ProjectWorkspaceReader.dropInstance();
- TestFileUtils.deleteFile( BUILD_DIR );
- }
- finally
- {
- super.tearDown();
- }
- }
-
- @Override
- public void configureProject( String filename, int logLevel )
- throws BuildException
- {
- super.configureProject( filename, logLevel );
- DefaultLogger logger = new DefaultLogger()
- {
- @Override
- protected void printMessage( String message, PrintStream stream, int priority )
- {
- message = System.currentTimeMillis() + " " + message;
- super.printMessage( message, stream, priority );
- }
- };
- logger.setMessageOutputLevel( logLevel );
- logger.setOutputPrintStream( System.out );
- logger.setErrorPrintStream( System.err );
- getProject().addBuildListener( logger );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/DeployTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/DeployTest.java b/src/test/java/org/eclipse/aether/ant/DeployTest.java
deleted file mode 100644
index f0ce232..0000000
--- a/src/test/java/org/eclipse/aether/ant/DeployTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-
-import java.io.File;
-import java.util.Arrays;
-
-/*
- * still missing:
- * - deploy snapshots/releases into correct repos
- */
-public class DeployTest
- extends AntBuildsTest
-{
-
- public void testDeployGlobalPom()
- {
- long min = System.currentTimeMillis();
- executeTarget( "testDeployGlobalPom" );
- long max = System.currentTimeMillis();
-
- assertLogContaining( "Uploading" );
-
- assertUpdatedFile( min, max, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
- }
-
- public void testDeployOverrideGlobalPom()
- {
- long min = System.currentTimeMillis();
- executeTarget( "testDeployOverrideGlobalPom" );
- long max = System.currentTimeMillis();
-
- assertLogContaining( "Uploading" );
-
- assertUpdatedFile( min, max, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
- }
-
- public void testDeployOverrideGlobalPomByRef()
- {
- long min = System.currentTimeMillis();
- executeTarget( "testDeployOverrideGlobalPomByRef" );
- long max = System.currentTimeMillis();
-
- assertLogContaining( "Uploading" );
-
- assertUpdatedFile( min, max, distRepoDir, "test/dummy/0.1-SNAPSHOT/maven-metadata.xml" );
- assertUpdatedFile( min, max, distRepoDir, "test/other/0.1-SNAPSHOT/maven-metadata.xml" );
- }
-
- public void testDeployAttachedArtifact()
- {
- executeTarget( "testDeployAttachedArtifact" );
-
- assertLogContaining( "Uploading" );
-
- File dir = new File(distRepoDir, "test/dummy/0.1-SNAPSHOT/" );
- String[] files = dir.list();
- assertThat( "attached artifact not found: " + Arrays.toString( files ), files,
- hasItemInArray( endsWith( "-ant.xml" ) ) );
- }
-
- private void assertUpdatedFile( long min, long max, File repoPath, String path )
- {
- File file = new File( repoPath, path );
- min = (min / 1000) * 1000;
- max = ((max + 999) / 1000) * 1000;
- assertThat( "File does not exist in default repo: " + file.getAbsolutePath(), file.exists() );
- assertThat( "Files were not updated for 1s before/after timestamp", file.lastModified(),
- allOf( greaterThanOrEqualTo( min ), lessThanOrEqualTo( max ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/InstallTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/InstallTest.java b/src/test/java/org/eclipse/aether/ant/InstallTest.java
deleted file mode 100644
index 33d662d..0000000
--- a/src/test/java/org/eclipse/aether/ant/InstallTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-
-import java.io.File;
-import java.io.IOException;
-
-public class InstallTest
- extends AntBuildsTest
-{
-
- public void testInstallGlobalPom()
- {
- executeTarget( "testInstallGlobalPom" );
- long tstamp = System.currentTimeMillis();
-
- assertLogContaining( "Installing" );
-
- assertUpdatedFile( tstamp, localRepoDir, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT.pom" );
- }
-
- public void testInstallOverrideGlobalPom()
- {
- executeTarget( "testInstallOverrideGlobalPom" );
- long tstamp = System.currentTimeMillis();
-
- assertLogContaining( "Installing" );
-
- assertUpdatedFile( tstamp, localRepoDir, "test/other/0.1-SNAPSHOT/other-0.1-SNAPSHOT.pom" );
- }
-
- public void testInstallOverrideGlobalPomByRef()
- {
- long tstamp = System.currentTimeMillis();
- executeTarget( "testInstallOverrideGlobalPomByRef" );
-
- assertLogContaining( "Installing" );
-
- assertUpdatedFile( tstamp, localRepoDir, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT.pom" );
- assertUpdatedFile( tstamp, localRepoDir, "test/other/0.1-SNAPSHOT/other-0.1-SNAPSHOT.pom" );
- }
-
- public void testDefaultRepo()
- {
- executeTarget( "testDefaultRepo" );
- long tstamp = System.currentTimeMillis();
-
- assertLogContaining( "Installing" );
-
- assertUpdatedFile( tstamp, localRepoDir, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT.pom" );
- assertUpdatedFile( tstamp, localRepoDir, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT-ant.xml" );
- }
-
- public void testCustomRepo()
- throws IOException
- {
- File repoPath = new File( BUILD_DIR, "local-repo-custom" );
-
- executeTarget( "testCustomRepo" );
- long tstamp = System.currentTimeMillis();
-
- System.out.println( getLog() );
- assertLogContaining( "Installing" );
-
- assertUpdatedFile( tstamp, repoPath, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT.pom" );
- assertUpdatedFile( tstamp, repoPath, "test/dummy/0.1-SNAPSHOT/dummy-0.1-SNAPSHOT-ant.xml" );
- }
-
- private void assertUpdatedFile( long tstamp, File repoPath, String path )
- {
- File file = new File( repoPath, path );
- assertThat( "File does not exist in default repo: " + file.getAbsolutePath(), file.exists() );
- assertThat( "Files were not updated for 1s before/after timestamp",
- file.lastModified(),
- allOf( greaterThanOrEqualTo( ( ( tstamp - 500 ) / 1000 ) * 1000 ),
- lessThanOrEqualTo( tstamp + 2000 ) ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/ProjectWorkspaceReaderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/ProjectWorkspaceReaderTest.java b/src/test/java/org/eclipse/aether/ant/ProjectWorkspaceReaderTest.java
deleted file mode 100644
index 1ad937a..0000000
--- a/src/test/java/org/eclipse/aether/ant/ProjectWorkspaceReaderTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-
-import org.apache.tools.ant.Project;
-import org.eclipse.aether.ant.ProjectWorkspaceReader;
-import org.eclipse.aether.ant.types.Pom;
-import org.junit.Before;
-import org.junit.Test;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-
-public class ProjectWorkspaceReaderTest
-{
-
- private ProjectWorkspaceReader reader;
-
- private Project project;
-
- @Before
- public void setUp()
- throws Exception
- {
- this.reader = new ProjectWorkspaceReader();
-
- this.project = new Project();
- project.setProperty( "user.home", System.getProperty( "user.home" ) );
- }
-
- private Artifact artifact( String coords )
- {
- return new DefaultArtifact( coords );
- }
-
- private File getFile( String name )
- {
- return new File( "src/test/resources/ProjectWorkspaceReader", name );
- }
-
- @Test
- public void testFindPom()
- {
- Pom pom = new Pom();
- pom.setProject( project );
- pom.setFile( getFile( "dummy-pom.xml" ) );
-
- reader.addPom( pom );
-
- assertEquals( pom.getFile(), reader.findArtifact( artifact( "test:dummy:pom:0.1-SNAPSHOT" ) ) );
- assertNull( reader.findArtifact( artifact( "unavailable:test:pom:0.1-SNAPSHOT" ) ) );
- }
-
- @Test
- public void testFindArtifact()
- {
- Pom pom = new Pom();
- pom.setProject( project );
- pom.setFile( getFile( "dummy-pom.xml" ) );
-
- reader.addPom( pom );
-
- org.eclipse.aether.ant.types.Artifact artifact = new org.eclipse.aether.ant.types.Artifact();
- artifact.setProject( project );
- artifact.addPom( pom );
- artifact.setFile( getFile( "dummy-file.txt" ) );
-
- reader.addArtifact( artifact );
-
- assertEquals( artifact.getFile(), reader.findArtifact( artifact( "test:dummy:txt:0.1-SNAPSHOT" ) ) );
- assertNull( reader.findArtifact( artifact( "unavailable:test:jar:0.1-SNAPSHOT" ) ) );
- }
-
- @Test
- public void testFindVersions()
- {
- Pom pom1 = new Pom();
- pom1.setProject( project );
- pom1.setCoords( "test:dummy:1-SNAPSHOT" );
-
- org.eclipse.aether.ant.types.Artifact artifact1 = new org.eclipse.aether.ant.types.Artifact();
- artifact1.setProject( project );
- artifact1.addPom( pom1 );
- artifact1.setFile( getFile( "dummy-file.txt" ) );
-
- reader.addArtifact( artifact1 );
-
- Pom pom2 = new Pom();
- pom2.setProject( project );
- pom2.setCoords( "test:dummy:2-SNAPSHOT" );
-
- org.eclipse.aether.ant.types.Artifact artifact2 = new org.eclipse.aether.ant.types.Artifact();
- artifact2.setProject( project );
- artifact2.addPom( pom2 );
- artifact2.setFile( getFile( "dummy-file.txt" ) );
-
- reader.addArtifact( artifact2 );
-
- assertThat( reader.findVersions( artifact( "test:dummy:txt:[0,)" ) ),
- containsInAnyOrder( "1-SNAPSHOT", "2-SNAPSHOT" ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/ReactorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/ReactorTest.java b/src/test/java/org/eclipse/aether/ant/ReactorTest.java
deleted file mode 100644
index 12a724d..0000000
--- a/src/test/java/org/eclipse/aether/ant/ReactorTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.aether.ant.ProjectWorkspaceReader;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-
-public class ReactorTest
- extends AntBuildsTest
-{
-
- private Artifact artifact( String coords )
- {
- return new DefaultArtifact( coords );
- }
-
- public void testPom()
- throws IOException
- {
- executeTarget( "testPom" );
- ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
- File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
- assertNotNull( found );
- assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
- }
-
- public void testArtifact()
- throws IOException
- {
- executeTarget( "testArtifact" );
- ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
- File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
- assertNotNull( found );
- assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
-
- found = reader.findArtifact( artifact( "test:test:xml:0.1-SNAPSHOT" ) );
- assertNotNull( found );
- assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
- }
-
- public void testArtifactInMemoryPom()
- throws IOException
- {
- executeTarget( "testArtifactInMemoryPom" );
- ProjectWorkspaceReader reader = ProjectWorkspaceReader.getInstance();
- File found = reader.findArtifact( artifact( "test:test:pom:0.1-SNAPSHOT" ) );
- assertNull( found );
-
- found = reader.findArtifact( artifact( "test:test:xml:0.1-SNAPSHOT" ) );
- assertNotNull( found );
- assertEquals( new File( projectDir, "pom1.xml" ), found.getAbsoluteFile() );
- }
-
- public void testResolveArtifact()
- throws IOException
- {
- executeTarget( "testResolveArtifact" );
- String prop = project.getProperty( "resolve.test:test:jar" );
- assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
- }
-
- public void testResolveArtifactInMemoryPom()
- throws IOException
- {
- executeTarget( "testResolveArtifactInMemoryPom" );
- String prop = project.getProperty( "resolve.test:test:jar" );
- assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
- assertLogContaining( "The POM for test:test:jar:0.1-SNAPSHOT is missing, no dependency information available" );
- }
-
- public void testResolveVersionRange()
- throws IOException
- {
- executeTarget( "testResolveVersionRange" );
- String prop = project.getProperty( "resolve.test:test:jar" );
- assertEquals( new File( projectDir, "pom1.xml" ).getAbsolutePath(), prop );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/ResolveTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/ResolveTest.java b/src/test/java/org/eclipse/aether/ant/ResolveTest.java
deleted file mode 100644
index cf3d545..0000000
--- a/src/test/java/org/eclipse/aether/ant/ResolveTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Map;
-
-import org.apache.tools.ant.types.Path;
-
-public class ResolveTest
- extends AntBuildsTest
-{
-
- public void testResolveGlobalPom()
- {
- executeTarget( "testResolveGlobalPom" );
-
- String prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-api:jar" );
- assertThat( "aether-api was not resolved as a property", prop, notNullValue() );
- assertThat( "aether-api was not resolved to default local repository", prop,
- allOf( containsString( "aether-api" ), endsWith( ".jar" ) ) );
- }
-
- public void testResolveOverrideGlobalPom()
- {
- executeTarget( "testResolveOverrideGlobalPom" );
-
- String prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-api:jar" );
- assertThat( "aether-api was not resolved as a property", prop, notNullValue() );
- assertThat( "aether-api was not resolved to default local repository", prop,
- allOf( containsString( "aether-api" ), endsWith( ".jar" ) ) );
- }
-
- public void testResolveGlobalPomIntoOtherLocalRepo()
- {
- executeTarget( "testResolveGlobalPomIntoOtherLocalRepo" );
-
- String prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-api:jar" );
- assertThat( "aether-api was not resolved as a property", prop, notNullValue() );
- assertThat( "aether-api was not resolved to default local repository", prop.replace( '\\', '/' ),
- endsWith( "local-repo-custom/org/eclipse/aether/aether-api/0.9.0.M3/aether-api-0.9.0.M3.jar" ) );
- }
-
- public void testResolveCustomFileLayout()
- throws IOException
- {
- File dir = new File( BUILD_DIR, "resolve-custom-layout" );
- executeTarget( "testResolveCustomFileLayout" );
-
- assertThat( "aether-api was not saved with custom file layout",
- new File( dir, "org.eclipse.aether/aether-api/org/eclipse/aether/jar" ).exists() );
- }
-
- public void testResolveAttachments()
- throws IOException
- {
- File dir = new File( BUILD_DIR, "resolve-attachments" );
- executeTarget( "testResolveAttachments" );
-
- File jdocDir = new File(dir, "javadoc");
-
- assertThat( "aether-api-javadoc was not saved with custom file layout",
- new File( jdocDir, "org.eclipse.aether-aether-api-javadoc.jar" ).exists() );
-
- assertThat( "found non-javadoc files", Arrays.asList( jdocDir.list() ), everyItem( endsWith( "javadoc.jar" ) ) );
-
- File sourcesDir = new File( dir, "sources" );
- assertThat( "aether-api-sources was not saved with custom file layout",
- new File( sourcesDir, "org.eclipse.aether-aether-api-sources.jar" ).exists() );
- assertThat( "found non-sources files", Arrays.asList( sourcesDir.list() ),
- everyItem( endsWith( "sources.jar" ) ) );
- }
-
- public void testResolvePath()
- {
- executeTarget( "testResolvePath" );
- Map<?, ?> refs = getProject().getReferences();
- Object obj = refs.get( "out" );
- assertThat( "ref 'out' is no path", obj, instanceOf( Path.class ) );
- Path path = (Path) obj;
- String[] elements = path.list();
- assertThat( "no aether-api on classpath", elements,
- hasItemInArray( allOf( containsString( "aether-api" ), endsWith( ".jar" ) ) ) );
- }
-
- public void testResolveDepsFromFile()
- {
- executeTarget( "testResolveDepsFromFile" );
-
- String prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-spi:jar" );
- assertThat( "aether-spi was not resolved as a property", prop, notNullValue() );
- assertThat( "aether-spi was not resolved to default local repository", prop,
- allOf( containsString( "aether-spi" ), endsWith( ".jar" ) ) );
- prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-api:jar" );
- assertThat( "aether-api was resolved as a property", prop, nullValue() );
- }
-
- public void testResolveNestedDependencyCollections()
- {
- executeTarget( "testResolveNestedDependencyCollections" );
-
- String prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-spi:jar" );
- assertThat( "aether-spi was not resolved as a property", prop, notNullValue() );
- prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-util:jar" );
- assertThat( "aether-util was not resolved as a property", prop, notNullValue() );
- prop = getProject().getProperty( "test.resolve.path.org.eclipse.aether:aether-api:jar" );
- assertThat( "aether-api was resolved as a property", prop, nullValue() );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/SettingsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/SettingsTest.java b/src/test/java/org/eclipse/aether/ant/SettingsTest.java
deleted file mode 100644
index d292a21..0000000
--- a/src/test/java/org/eclipse/aether/ant/SettingsTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant;
-
-import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.Matchers.*;
-
-import java.io.File;
-import java.io.IOException;
-
-public class SettingsTest
- extends AntBuildsTest
-{
-
- public void testUserSettings()
- {
- executeTarget( "testUserSettings" );
- assertThat( "user settings not set", AntRepoSys.getInstance( getProject() ).getUserSettings().getName(),
- equalTo( "userSettings.xml" ) );
- }
-
- public void testGlobalSettings()
- {
- executeTarget( "testGlobalSettings" );
- assertThat( "global settings not set", AntRepoSys.getInstance( getProject() ).getGlobalSettings().getName(),
- equalTo( "globalSettings.xml" ) );
- }
-
- public void testBothSettings()
- {
- executeTarget( "testBothSettings" );
- assertThat( "global settings not set", AntRepoSys.getInstance( getProject() ).getGlobalSettings().getName(),
- equalTo( "globalSettings.xml" ) );
- assertThat( "user settings not set", AntRepoSys.getInstance( getProject() ).getUserSettings().getName(),
- equalTo( "userSettings.xml" ) );
- }
-
- public void testFallback()
- throws IOException
- {
- executeTarget("setUp");
- assertThat( "no fallback to local settings",
- AntRepoSys.getInstance( getProject() ).getUserSettings().getAbsolutePath(), endsWith( ".m2"
- + File.separator + "settings.xml" ) );
- }
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/tasks/LayoutTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/tasks/LayoutTest.java b/src/test/java/org/eclipse/aether/ant/tasks/LayoutTest.java
deleted file mode 100644
index bc5e476..0000000
--- a/src/test/java/org/eclipse/aether/ant/tasks/LayoutTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant.tasks;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tools.ant.BuildException;
-import org.eclipse.aether.ant.tasks.Layout;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.junit.Test;
-
-/**
- */
-public class LayoutTest
-{
-
- @Test( expected = BuildException.class )
- public void testUnknownVariable()
- {
- new Layout( "{unknown}" );
- }
-
- @Test
- public void testGetPath()
- {
- Layout layout;
-
- layout =
- new Layout( "{groupIdDirs}/{artifactId}/{baseVersion}/{artifactId}-{version}-{classifier}.{extension}" );
- assertEquals( "org/apache/maven/maven-model/3.0-SNAPSHOT/maven-model-3.0-20100720.132618-1.jar",
- layout.getPath( new DefaultArtifact( "org.apache.maven:maven-model:3.0-20100720.132618-1" ) ) );
-
- layout = new Layout( "{groupId}/{artifactId}-{version}-{classifier}.{extension}" );
- assertEquals( "org.apache.maven/maven-model-3.0-sources.jar",
- layout.getPath( new DefaultArtifact( "org.apache.maven:maven-model:jar:sources:3.0" ) ) );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/1ec78d99/src/test/java/org/eclipse/aether/ant/types/DependencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/eclipse/aether/ant/types/DependencyTest.java b/src/test/java/org/eclipse/aether/ant/types/DependencyTest.java
deleted file mode 100644
index 82b0020..0000000
--- a/src/test/java/org/eclipse/aether/ant/types/DependencyTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Sonatype, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.aether.ant.types;
-
-import static org.junit.Assert.*;
-
-import org.eclipse.aether.ant.types.Dependency;
-import org.junit.Test;
-
-/**
- */
-public class DependencyTest
-{
-
- @Test
- public void testSetCoordsGidAidVer()
- {
- Dependency dep = new Dependency();
- dep.setCoords( "gid:aid:ver" );
-
- assertEquals( "gid", dep.getGroupId() );
- assertEquals( "aid", dep.getArtifactId() );
- assertEquals( "ver", dep.getVersion() );
- assertEquals( "jar", dep.getType() );
- assertEquals( "", dep.getClassifier() );
- assertEquals( "compile", dep.getScope() );
- }
-
- @Test
- public void testSetCoordsGidAidVerScope()
- {
- Dependency dep = new Dependency();
- dep.setCoords( "gid:aid:ver:scope" );
-
- assertEquals( "gid", dep.getGroupId() );
- assertEquals( "aid", dep.getArtifactId() );
- assertEquals( "ver", dep.getVersion() );
- assertEquals( "jar", dep.getType() );
- assertEquals( "", dep.getClassifier() );
- assertEquals( "scope", dep.getScope() );
- }
-
- @Test
- public void testSetCoordsGidAidVerTypeScope()
- {
- Dependency dep = new Dependency();
- dep.setCoords( "gid:aid:ver:type:scope" );
-
- assertEquals( "gid", dep.getGroupId() );
- assertEquals( "aid", dep.getArtifactId() );
- assertEquals( "ver", dep.getVersion() );
- assertEquals( "type", dep.getType() );
- assertEquals( "", dep.getClassifier() );
- assertEquals( "scope", dep.getScope() );
- }
-
- @Test
- public void testSetCoordsGidAidVerTypeClsScope()
- {
- Dependency dep = new Dependency();
- dep.setCoords( "gid:aid:ver:type:cls:scope" );
-
- assertEquals( "gid", dep.getGroupId() );
- assertEquals( "aid", dep.getArtifactId() );
- assertEquals( "ver", dep.getVersion() );
- assertEquals( "type", dep.getType() );
- assertEquals( "cls", dep.getClassifier() );
- assertEquals( "scope", dep.getScope() );
- }
-
-}