fixed errors reported by Checkstyle

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@958295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2010-06-26 23:16:18 +00:00
parent 4e202d7d01
commit 23f2095652
234 changed files with 3413 additions and 2645 deletions

View File

@ -81,17 +81,21 @@ public class DefaultArtifact
private boolean optional; private boolean optional;
public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, String classifier, ArtifactHandler artifactHandler ) public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type,
String classifier, ArtifactHandler artifactHandler )
{ {
this( groupId, artifactId, VersionRange.createFromVersion( version ), scope, type, classifier, artifactHandler, false ); this( groupId, artifactId, VersionRange.createFromVersion( version ), scope, type, classifier, artifactHandler,
false );
} }
public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, ArtifactHandler artifactHandler ) public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type,
String classifier, ArtifactHandler artifactHandler )
{ {
this( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler, false ); this( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler, false );
} }
public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, ArtifactHandler artifactHandler, boolean optional ) public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type,
String classifier, ArtifactHandler artifactHandler, boolean optional )
{ {
this.groupId = groupId; this.groupId = groupId;

View File

@ -1,20 +1,25 @@
package org.apache.maven.artifact.repository; package org.apache.maven.artifact.repository;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.util.List; import java.util.List;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;

View File

@ -61,9 +61,7 @@ public ArtifactRepositoryPolicy( ArtifactRepositoryPolicy policy )
this( policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy() ); this( policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy() );
} }
public ArtifactRepositoryPolicy( boolean enabled, public ArtifactRepositoryPolicy( boolean enabled, String updatePolicy, String checksumPolicy )
String updatePolicy,
String checksumPolicy )
{ {
this.enabled = enabled; this.enabled = enabled;

View File

@ -1,8 +1,5 @@
package org.apache.maven.artifact.repository.layout; package org.apache.maven.artifact.repository.layout;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -22,6 +19,9 @@
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
public interface ArtifactRepositoryLayout2 public interface ArtifactRepositoryLayout2
extends ArtifactRepositoryLayout extends ArtifactRepositoryLayout
{ {

View File

@ -1,20 +1,25 @@
package org.apache.maven.artifact.resolver; package org.apache.maven.artifact.resolver;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.util.List; import java.util.List;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
@ -35,30 +40,36 @@ protected ArtifactNotFoundException( String message, Artifact artifact, List<Art
public ArtifactNotFoundException( String message, Artifact artifact ) public ArtifactNotFoundException( String message, Artifact artifact )
{ {
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
.getDependencyTrail() ); artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
} }
protected ArtifactNotFoundException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, Throwable cause ) protected ArtifactNotFoundException( String message, Artifact artifact,
List<ArtifactRepository> remoteRepositories, Throwable cause )
{ {
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
.getDependencyTrail(), cause ); artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(),
cause );
} }
public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier, List<ArtifactRepository> remoteRepositories, public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
String classifier, List<ArtifactRepository> remoteRepositories,
String downloadUrl, List<String> path, Throwable cause ) String downloadUrl, List<String> path, Throwable cause )
{ {
super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId, version, type, classifier, remoteRepositories, super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
null, cause ); downloadUrl, path ), groupId, artifactId, version, type, classifier,
remoteRepositories, null, cause );
this.downloadUrl = downloadUrl; this.downloadUrl = downloadUrl;
} }
private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier, List<ArtifactRepository> remoteRepositories, private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
String classifier, List<ArtifactRepository> remoteRepositories,
String downloadUrl, List<String> path ) String downloadUrl, List<String> path )
{ {
super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId, version, type, classifier, remoteRepositories, super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
null ); downloadUrl, path ), groupId, artifactId, version, type, classifier,
remoteRepositories, null );
this.downloadUrl = downloadUrl; this.downloadUrl = downloadUrl;
} }

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.resolver; package org.apache.maven.artifact.resolver;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.util.List; import java.util.List;
@ -34,7 +38,8 @@ public ArtifactResolutionException( String message, String groupId, String artif
super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t ); super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t );
} }
public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, Throwable t ) public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type,
String classifier, Throwable t )
{ {
super( message, groupId, artifactId, version, type, classifier, null, null, t ); super( message, groupId, artifactId, version, type, classifier, null, null, t );
} }
@ -54,7 +59,8 @@ public ArtifactResolutionException( String message, Artifact artifact, Throwable
super( message, artifact, null, cause ); super( message, artifact, null, cause );
} }
public ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, Throwable cause ) public ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories,
Throwable cause )
{ {
super( message, artifact, remoteRepositories, cause ); super( message, artifact, remoteRepositories, cause );
} }

View File

@ -67,15 +67,15 @@ public class ComparableVersion
private interface Item private interface Item
{ {
public static final int INTEGER_ITEM = 0; final int INTEGER_ITEM = 0;
public static final int STRING_ITEM = 1; final int STRING_ITEM = 1;
public static final int LIST_ITEM = 2; final int LIST_ITEM = 2;
public int compareTo( Item item ); int compareTo( Item item );
public int getType(); int getType();
public boolean isNull(); boolean isNull();
} }
/** /**
@ -145,21 +145,23 @@ public String toString()
private static class StringItem private static class StringItem
implements Item implements Item
{ {
private final static String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" }; private static final String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" };
private final static List<String> _QUALIFIERS = Arrays.asList( QUALIFIERS ); private static final List<String> _QUALIFIERS = Arrays.asList( QUALIFIERS );
private final static Properties ALIASES = new Properties(); private static final Properties ALIASES = new Properties();
static { static
{
ALIASES.put( "ga", "" ); ALIASES.put( "ga", "" );
ALIASES.put( "final", "" ); ALIASES.put( "final", "" );
ALIASES.put( "cr", "rc" ); ALIASES.put( "cr", "rc" );
} }
/** /**
* A comparable value for the empty-string qualifier. This one is used to determine if a given qualifier makes the * A comparable value for the empty-string qualifier. This one is used to determine if a given qualifier makes
* version older than one without a qualifier, or more recent. * the version older than one without a qualifier, or more recent.
*/ */
private static String RELEASE_VERSION_INDEX = String.valueOf( _QUALIFIERS.indexOf( "" ) ); private static final String RELEASE_VERSION_INDEX = String.valueOf( _QUALIFIERS.indexOf( "" ) );
private String value; private String value;
@ -285,7 +287,7 @@ public int compareTo( Item item )
{ {
return 0; // 1-0 = 1- (normalize) = 1 return 0; // 1-0 = 1- (normalize) = 1
} }
Item first = (Item) get(0); Item first = get( 0 );
return first.compareTo( null ); return first.compareTo( null );
} }
switch ( item.getType() ) switch ( item.getType() )
@ -302,8 +304,8 @@ public int compareTo( Item item )
while ( left.hasNext() || right.hasNext() ) while ( left.hasNext() || right.hasNext() )
{ {
Item l = left.hasNext() ? (Item) left.next() : null; Item l = left.hasNext() ? left.next() : null;
Item r = right.hasNext() ? (Item) right.next() : null; Item r = right.hasNext() ? right.next() : null;
// if this is shorter, then invert the compare and mul with -1 // if this is shorter, then invert the compare and mul with -1
int result = l == null ? -1 * r.compareTo( l ) : l.compareTo( r ); int result = l == null ? -1 * r.compareTo( l ) : l.compareTo( r );

View File

@ -39,9 +39,7 @@ public class Restriction
public static final Restriction EVERYTHING = new Restriction( null, false, null, false ); public static final Restriction EVERYTHING = new Restriction( null, false, null, false );
public Restriction( ArtifactVersion lowerBound, public Restriction( ArtifactVersion lowerBound, boolean lowerBoundInclusive, ArtifactVersion upperBound,
boolean lowerBoundInclusive,
ArtifactVersion upperBound,
boolean upperBoundInclusive ) boolean upperBoundInclusive )
{ {
this.lowerBound = lowerBound; this.lowerBound = lowerBound;

View File

@ -21,11 +21,11 @@
public class Proxy public class Proxy
{ {
public final static String PROXY_SOCKS5 = "SOCKS_5"; public static final String PROXY_SOCKS5 = "SOCKS_5";
public final static String PROXY_SOCKS4 = "SOCKS4"; public static final String PROXY_SOCKS4 = "SOCKS4";
public final static String PROXY_HTTP = "HTTP"; public static final String PROXY_HTTP = "HTTP";
/** /**
* Proxy server host * Proxy server host

View File

@ -110,7 +110,9 @@ public boolean encloses( ArtifactScopeEnum scope )
// system scope is historic only - and simple // system scope is historic only - and simple
if ( id == system.id ) if ( id == system.id )
{
return scope.id == system.id; return scope.id == system.id;
}
for ( ArtifactScopeEnum[][] set : _compliancySets ) for ( ArtifactScopeEnum[][] set : _compliancySets )
{ {
@ -119,8 +121,10 @@ public boolean encloses( ArtifactScopeEnum scope )
for ( ArtifactScopeEnum ase : set[1] ) for ( ArtifactScopeEnum ase : set[1] )
{ {
if ( s.id == ase.id ) if ( s.id == ase.id )
{
return true; return true;
} }
}
break; break;
} }
} }

View File

@ -19,7 +19,6 @@
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/** /**
@ -35,16 +34,13 @@ public class UnknownRepositoryLayoutException
private final String layoutId; private final String layoutId;
public UnknownRepositoryLayoutException( String repositoryId, public UnknownRepositoryLayoutException( String repositoryId, String layoutId )
String layoutId )
{ {
super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId ); super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId );
this.layoutId = layoutId; this.layoutId = layoutId;
} }
public UnknownRepositoryLayoutException( String repositoryId, public UnknownRepositoryLayoutException( String repositoryId, String layoutId, ComponentLookupException e )
String layoutId,
ComponentLookupException e )
{ {
super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId, e ); super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId, e );
this.layoutId = layoutId; this.layoutId = layoutId;

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.deployer; package org.apache.maven.artifact.deployer;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -29,16 +33,17 @@ public interface ArtifactDeployer
* filename of the source file. * filename of the source file.
* *
* @param basedir the directory where the artifact is stored * @param basedir the directory where the artifact is stored
* @param finalName the name of the artifact sans extension * @param finalName the name of the artifact without extension
* @param artifact the artifact definition * @param artifact the artifact definition
* @param deploymentRepository the repository to deploy to * @param deploymentRepository the repository to deploy to
* @param localRepository the local repository to install into * @param localRepository the local repository to install into
* @throws ArtifactDeploymentException if an error occurred deploying the artifact * @throws ArtifactDeploymentException if an error occurred deploying the artifact
* @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate * @deprecated to be removed before 2.0 after the install/deploy plugins use the alternate
* method * method
*/ */
@Deprecated @Deprecated
void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;
/** /**
@ -50,6 +55,7 @@ void deploy( String basedir, String finalName, Artifact artifact, ArtifactReposi
* @param localRepository the local repository to install into * @param localRepository the local repository to install into
* @throws ArtifactDeploymentException if an error occurred deploying the artifact * @throws ArtifactDeploymentException if an error occurred deploying the artifact
*/ */
void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;
} }

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.deployer; package org.apache.maven.artifact.deployer;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -65,7 +69,8 @@ public class DefaultArtifactDeployer
* correctly. * correctly.
*/ */
@Deprecated @Deprecated
public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {
String extension = artifact.getArtifactHandler().getExtension(); String extension = artifact.getArtifactHandler().getExtension();
@ -73,7 +78,8 @@ public void deploy( String basedir, String finalName, Artifact artifact, Artifac
deploy( source, artifact, deploymentRepository, localRepository ); deploy( source, artifact, deploymentRepository, localRepository );
} }
public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {
deploymentRepository = injectSession( deploymentRepository ); deploymentRepository = injectSession( deploymentRepository );

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.installer; package org.apache.maven.artifact.installer;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;

View File

@ -1,14 +1,5 @@
package org.apache.maven.artifact.manager; package org.apache.maven.artifact.manager;
import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -28,6 +19,14 @@
* under the License. * under the License.
*/ */
import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
/** /**
* Manages <a href="http://maven.apache.org/wagon">Wagon</a> related operations in Maven. * Manages <a href="http://maven.apache.org/wagon">Wagon</a> related operations in Maven.

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.repository; package org.apache.maven.artifact.repository;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import org.apache.maven.artifact.UnknownRepositoryLayoutException; import org.apache.maven.artifact.UnknownRepositoryLayoutException;
@ -35,12 +39,15 @@ ArtifactRepositoryLayout getLayout( String layoutId )
ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ); ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
boolean uniqueVersion );
ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) ArtifactRepository createArtifactRepository( String id, String url, String layoutId,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases );
void setGlobalUpdatePolicy( String snapshotPolicy ); void setGlobalUpdatePolicy( String snapshotPolicy );

View File

@ -88,7 +88,8 @@ public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayou
* @param snapshots the policies to use for snapshots * @param snapshots the policies to use for snapshots
* @param releases the policies to use for releases * @param releases the policies to use for releases
*/ */
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
{ {
super( id, url ); super( id, url );
@ -121,8 +122,7 @@ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata
return layout.pathOfRemoteRepositoryMetadata( artifactMetadata ); return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
} }
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
ArtifactRepository repository )
{ {
return layout.pathOfLocalRepositoryMetadata( metadata, repository ); return layout.pathOfLocalRepositoryMetadata( metadata, repository );
} }

View File

@ -54,26 +54,22 @@ public ArtifactRepositoryLayout getLayout( String layoutId )
return factory.getLayout( layoutId ); return factory.getLayout( layoutId );
} }
public ArtifactRepository createDeploymentArtifactRepository( String id, public ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId,
String url,
String layoutId,
boolean uniqueVersion ) boolean uniqueVersion )
throws UnknownRepositoryLayoutException throws UnknownRepositoryLayoutException
{ {
return injectSession( factory.createDeploymentArtifactRepository( id, url, layoutId, uniqueVersion ), false ); return injectSession( factory.createDeploymentArtifactRepository( id, url, layoutId, uniqueVersion ), false );
} }
public ArtifactRepository createDeploymentArtifactRepository( String id, public ArtifactRepository createDeploymentArtifactRepository( String id, String url,
String url,
ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryLayout repositoryLayout,
boolean uniqueVersion ) boolean uniqueVersion )
{ {
return injectSession( factory.createDeploymentArtifactRepository( id, url, repositoryLayout, uniqueVersion ), false); return injectSession( factory.createDeploymentArtifactRepository( id, url, repositoryLayout, uniqueVersion ),
false );
} }
public ArtifactRepository createArtifactRepository( String id, public ArtifactRepository createArtifactRepository( String id, String url, String layoutId,
String url,
String layoutId,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases ) ArtifactRepositoryPolicy releases )
throws UnknownRepositoryLayoutException throws UnknownRepositoryLayoutException
@ -81,8 +77,7 @@ public ArtifactRepository createArtifactRepository( String id,
return injectSession( factory.createArtifactRepository( layoutId, url, layoutId, snapshots, releases ), true ); return injectSession( factory.createArtifactRepository( layoutId, url, layoutId, snapshots, releases ), true );
} }
public ArtifactRepository createArtifactRepository( String id, public ArtifactRepository createArtifactRepository( String id, String url,
String url,
ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases ) ArtifactRepositoryPolicy releases )

View File

@ -65,8 +65,7 @@ public String pathOf( Artifact artifact )
return path.toString(); return path.toString();
} }
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
ArtifactRepository repository )
{ {
return pathOfRepositoryMetadata( metadata.getLocalFilename( repository ) ); return pathOfRepositoryMetadata( metadata.getLocalFilename( repository ) );
} }

View File

@ -60,7 +60,8 @@ public class DefaultRepositoryMetadataManager
@Requirement @Requirement
private UpdateCheckManager updateCheckManager; private UpdateCheckManager updateCheckManager;
public void resolve( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) public void resolve( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws RepositoryMetadataResolutionException throws RepositoryMetadataResolutionException
{ {
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
@ -204,7 +205,8 @@ else if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
} }
catch ( RepositoryMetadataStoreException e ) catch ( RepositoryMetadataStoreException e )
{ {
throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: " + e.getMessage(), e ); throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: "
+ e.getMessage(), e );
} }
if ( cache != null ) if ( cache != null )
@ -342,7 +344,8 @@ private static final class CacheRecord
} }
private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws RepositoryMetadataStoreException throws RepositoryMetadataStoreException
{ {
// TODO: currently this is first wins, but really we should take the latest by comparing either the // TODO: currently this is first wins, but really we should take the latest by comparing either the
@ -371,7 +374,9 @@ private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository
updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository ); updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository );
} }
private void updateSnapshotMetadata( RepositoryMetadata metadata, Map<ArtifactRepository, Metadata> previousMetadata, ArtifactRepository selected, ArtifactRepository localRepository ) private void updateSnapshotMetadata( RepositoryMetadata metadata,
Map<ArtifactRepository, Metadata> previousMetadata,
ArtifactRepository selected, ArtifactRepository localRepository )
throws RepositoryMetadataStoreException throws RepositoryMetadataStoreException
{ {
// TODO: this could be a lot nicer... should really be in the snapshot transformation? // TODO: this could be a lot nicer... should really be in the snapshot transformation?
@ -396,7 +401,8 @@ private void updateSnapshotMetadata( RepositoryMetadata metadata, Map<ArtifactRe
} }
else else
{ {
if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null ) && m.getVersioning().getSnapshot().isLocalCopy() ) if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null )
&& m.getVersioning().getSnapshot().isLocalCopy() )
{ {
m.getVersioning().getSnapshot().setLocalCopy( false ); m.getVersioning().getSnapshot().setLocalCopy( false );
metadata.setMetadata( m ); metadata.setMetadata( m );
@ -409,11 +415,14 @@ private void updateSnapshotMetadata( RepositoryMetadata metadata, Map<ArtifactRe
} }
} }
private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository, ArtifactRepository localRepository, Map<ArtifactRepository, Metadata> previousMetadata ) private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository,
ArtifactRepository localRepository, Map<ArtifactRepository, Metadata> previousMetadata )
{ {
boolean setRepository = false; boolean setRepository = false;
File metadataFile = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata, remoteRepository ) ); File metadataFile =
new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata,
remoteRepository ) );
if ( metadataFile.exists() ) if ( metadataFile.exists() )
{ {
@ -475,11 +484,13 @@ protected Metadata readMetadata( File mappingFile )
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e ); throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': "
+ e.getMessage(), e );
} }
catch ( XmlPullParserException e ) catch ( XmlPullParserException e )
{ {
throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e ); throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': "
+ e.getMessage(), e );
} }
finally finally
{ {
@ -490,8 +501,8 @@ protected Metadata readMetadata( File mappingFile )
} }
/** /**
* Ensures the last updated timestamp of the specified metadata does not refer to the future and fixes the local metadata if necessary to allow * Ensures the last updated timestamp of the specified metadata does not refer to the future and fixes the local
* proper merging/updating of metadata during deployment. * metadata if necessary to allow proper merging/updating of metadata during deployment.
*/ */
private void fixTimestamp( File metadataFile, Metadata metadata, Metadata reference ) private void fixTimestamp( File metadataFile, Metadata metadata, Metadata reference )
{ {
@ -547,7 +558,8 @@ private void fixTimestamp( File metadataFile, Metadata metadata, Metadata refere
} }
} }
public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository,
ArtifactRepository remoteRepository )
throws RepositoryMetadataResolutionException throws RepositoryMetadataResolutionException
{ {
File file; File file;
@ -557,7 +569,8 @@ public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository local
} }
catch ( TransferFailedException e ) catch ( TransferFailedException e )
{ {
throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " + remoteRepository.getId() + " due to an error: " + e.getMessage(), e ); throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: "
+ remoteRepository.getId() + " due to an error: " + e.getMessage(), e );
} }
try try
@ -574,18 +587,24 @@ public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository local
} }
} }
private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata,
ArtifactRepository localRepository,
ArtifactRepository remoteRepository )
throws TransferFailedException throws TransferFailedException
{ {
File file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) ); File file =
new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata,
remoteRepository ) );
try try
{ {
wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN ); wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file,
ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
} }
catch ( ResourceDoesNotExistException e ) catch ( ResourceDoesNotExistException e )
{ {
getLogger().info( metadata + " could not be found on repository: " + remoteRepository.getId() + ", so will be created" ); getLogger().info( metadata + " could not be found on repository: " + remoteRepository.getId()
+ ", so will be created" );
// delete the local copy so the old details aren't used. // delete the local copy so the old details aren't used.
if ( file.exists() ) if ( file.exists() )
@ -603,7 +622,8 @@ private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metad
return file; return file;
} }
public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository ) public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository,
ArtifactRepository deploymentRepository )
throws RepositoryMetadataDeploymentException throws RepositoryMetadataDeploymentException
{ {
File file; File file;
@ -616,7 +636,8 @@ public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepositor
} }
catch ( TransferFailedException e ) catch ( TransferFailedException e )
{ {
throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: " + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e ); throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: "
+ deploymentRepository.getId() + " due to an error: " + e.getMessage(), e );
} }
if ( file.isFile() ) if ( file.isFile() )
@ -634,7 +655,9 @@ public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepositor
else else
{ {
// It's a POM - we don't need to retrieve it first // It's a POM - we don't need to retrieve it first
file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); file =
new File( localRepository.getBasedir(),
localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) );
} }
try try

View File

@ -46,13 +46,15 @@ public interface ArtifactResolver
// USED BY SUREFIRE // USED BY SUREFIRE
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
// USED BY MAVEN ASSEMBLY PLUGIN // USED BY MAVEN ASSEMBLY PLUGIN
@Deprecated @Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map managedVersions, ArtifactRepository localRepository, Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
@ -60,19 +62,20 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
// USED BY MAVEN ASSEMBLY PLUGIN // USED BY MAVEN ASSEMBLY PLUGIN
@Deprecated @Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) Map managedVersions, ArtifactRepository localRepository,
throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactMetadataSource source, ArtifactFilter filter )
ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated @Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
Map managedVersions, ArtifactRepository localRepository, Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter, ArtifactMetadataSource source, ArtifactFilter filter,
@ -80,10 +83,9 @@ public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Ar
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@Deprecated @Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, ArtifactRepository localRepository, ArtifactMetadataSource source,
ArtifactMetadataSource source,
List<ResolutionListener> listeners ) List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@ -94,11 +96,13 @@ void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, Ar
// USED BY REMOTE RESOURCES PLUGIN // USED BY REMOTE RESOURCES PLUGIN
@Deprecated @Deprecated
void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, TransferListener downloadMonitor ) void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
TransferListener downloadMonitor )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
// USED BY ARCHETYPE DOWNLOADER // USED BY ARCHETYPE DOWNLOADER
@Deprecated @Deprecated
void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
} }

View File

@ -65,8 +65,7 @@ public void includeArtifact( Artifact artifact )
logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" ); logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" );
} }
public void omitForNearer( Artifact omitted, public void omitForNearer( Artifact omitted, Artifact kept )
Artifact kept )
{ {
String omittedVersion = omitted.getVersion(); String omittedVersion = omitted.getVersion();
String keptVersion = kept.getVersion(); String keptVersion = kept.getVersion();
@ -82,12 +81,10 @@ public void omitForCycle( Artifact omitted )
logger.debug( indent + omitted + " (removed - causes a cycle in the graph)" ); logger.debug( indent + omitted + " (removed - causes a cycle in the graph)" );
} }
public void updateScopeCurrentPom( Artifact artifact, public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
String ignoredScope )
{ {
logger.debug( logger.debug( indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope "
indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope " + artifact.getScope() + artifact.getScope() + " wins)" );
+ " wins)" );
// TODO: better way than static? this might hide messages in a reactor // TODO: better way than static? this might hide messages in a reactor
if ( !ignoredArtifacts.contains( artifact ) ) if ( !ignoredArtifacts.contains( artifact ) )
@ -99,8 +96,7 @@ public void updateScopeCurrentPom( Artifact artifact,
} }
} }
public void updateScope( Artifact artifact, public void updateScope( Artifact artifact, String scope )
String scope )
{ {
logger.debug( indent + artifact + " (setting artifactScope to: " + scope + ")" ); logger.debug( indent + artifact + " (setting artifactScope to: " + scope + ")" );
} }
@ -111,9 +107,7 @@ public void selectVersionFromRange( Artifact artifact )
+ artifact.getVersionRange() + ")" ); + artifact.getVersionRange() + ")" );
} }
public void restrictRange( Artifact artifact, public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange )
Artifact replacement,
VersionRange newRange )
{ {
logger.debug( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " logger.debug( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: "
+ replacement.getVersionRange() + " to: " + newRange + " )" ); + replacement.getVersionRange() + " to: " + newRange + " )" );
@ -125,8 +119,7 @@ public void restrictRange( Artifact artifact,
* more information) is needed to be able to determine when and if the version and/or artifactScope changes. See the two * more information) is needed to be able to determine when and if the version and/or artifactScope changes. See the two
* added methods, manageArtifactVersion and manageArtifactScope. * added methods, manageArtifactVersion and manageArtifactScope.
*/ */
public void manageArtifact( Artifact artifact, public void manageArtifact( Artifact artifact, Artifact replacement )
Artifact replacement )
{ {
String msg = indent + artifact; String msg = indent + artifact;
msg += " ("; msg += " (";
@ -142,8 +135,7 @@ public void manageArtifact( Artifact artifact,
logger.debug( msg ); logger.debug( msg );
} }
public void manageArtifactVersion( Artifact artifact, public void manageArtifactVersion( Artifact artifact, Artifact replacement )
Artifact replacement )
{ {
// only show msg if a change is actually taking place // only show msg if a change is actually taking place
if ( !replacement.getVersion().equals( artifact.getVersion() ) ) if ( !replacement.getVersion().equals( artifact.getVersion() ) )
@ -153,8 +145,7 @@ public void manageArtifactVersion( Artifact artifact,
} }
} }
public void manageArtifactScope( Artifact artifact, public void manageArtifactScope( Artifact artifact, Artifact replacement )
Artifact replacement )
{ {
// only show msg if a change is actually taking place // only show msg if a change is actually taking place
if ( !replacement.getScope().equals( artifact.getScope() ) ) if ( !replacement.getScope().equals( artifact.getScope() ) )
@ -164,8 +155,7 @@ public void manageArtifactScope( Artifact artifact,
} }
} }
public void manageArtifactSystemPath( Artifact artifact, public void manageArtifactSystemPath( Artifact artifact, Artifact replacement )
Artifact replacement )
{ {
// only show msg if a change is actually taking place // only show msg if a change is actually taking place
if ( !replacement.getScope().equals( artifact.getScope() ) ) if ( !replacement.getScope().equals( artifact.getScope() ) )

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.resolver; package org.apache.maven.artifact.resolver;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -157,7 +161,8 @@ private void injectSession2( ArtifactResolutionRequest request, MavenSession ses
} }
} }
public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, TransferListener resolutionListener ) public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, TransferListener resolutionListener )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
@ -167,7 +172,8 @@ public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositor
resolve( artifact, request, resolutionListener, false ); resolve( artifact, request, resolutionListener, false );
} }
public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
@ -177,7 +183,8 @@ public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRep
resolve( artifact, request, null, true ); resolve( artifact, request, null, true );
} }
private void resolve( Artifact artifact, RepositoryRequest request, TransferListener downloadMonitor, boolean force ) private void resolve( Artifact artifact, RepositoryRequest request, TransferListener downloadMonitor,
boolean force )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
if ( artifact == null ) if ( artifact == null )
@ -193,17 +200,20 @@ private void resolve( Artifact artifact, RepositoryRequest request, TransferList
if ( systemFile == null ) if ( systemFile == null )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached", artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached",
artifact );
} }
if ( !systemFile.exists() ) if ( !systemFile.exists() )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: " + systemFile, artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: "
+ systemFile, artifact );
} }
if ( !systemFile.isFile() ) if ( !systemFile.isFile() )
{ {
throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile, artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile,
artifact );
} }
artifact.setResolved( true ); artifact.setResolved( true );
@ -241,11 +251,13 @@ private void resolve( Artifact artifact, RepositoryRequest request, TransferList
if ( artifact.getRepository() != null ) if ( artifact.getRepository() != null )
{ {
// the transformations discovered the artifact - so use it exclusively // the transformations discovered the artifact - so use it exclusively
wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, request.isForceUpdate() ); wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor,
request.isForceUpdate() );
} }
else else
{ {
wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, request.isForceUpdate() ); wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor,
request.isForceUpdate() );
} }
if ( localRepositoryMaintainer != null ) if ( localRepositoryMaintainer != null )
@ -316,7 +328,8 @@ private void resolve( Artifact artifact, RepositoryRequest request, TransferList
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use: " + e.getMessage(), artifact, remoteRepositories, e ); throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use: "
+ e.getMessage(), artifact, remoteRepositories, e );
} }
} }
@ -372,52 +385,73 @@ private boolean isLocalCopy( Artifact artifact )
return localCopy; return localCopy;
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter ); return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
remoteRepositories, source, filter );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source ) Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null ); return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null ); return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, filter, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository,
ArtifactMetadataSource source ) ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
ArtifactMetadataSource source, List<ResolutionListener> listeners ) List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository,
ArtifactMetadataSource source,
List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
remoteRepositories, source, null, listeners ); remoteRepositories, source, null, listeners );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners ) Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter,
List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null ); return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
remoteRepositories, source, filter, listeners, null );
} }
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners, Map managedVersions, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter,
List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers ) List<ConflictResolver> conflictResolvers )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
@ -592,7 +626,8 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
// so we give this back to the calling code and let them deal with this information // so we give this back to the calling code and let them deal with this information
// appropriately. // appropriately.
if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations() || result.hasCircularDependencyExceptions() ) if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations()
|| result.hasCircularDependencyExceptions() )
{ {
return result; return result;
} }
@ -645,7 +680,8 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
return result; return result;
} }
public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
resolve( artifact, remoteRepositories, localRepository, null ); resolve( artifact, remoteRepositories, localRepository, null );
@ -667,8 +703,9 @@ private class ResolveTask
private final ArtifactResolutionResult result; private final ArtifactResolutionResult result;
public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact, TransferListener transferListener, public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact,
ArtifactResolutionRequest request, ArtifactResolutionResult result ) TransferListener transferListener, ArtifactResolutionRequest request,
ArtifactResolutionResult result )
{ {
this.classLoader = classLoader; this.classLoader = classLoader;
this.latch = latch; this.latch = latch;

View File

@ -72,7 +72,8 @@ public ProfilesRoot buildProfiles( File basedir )
} }
catch ( Exception e ) catch ( Exception e )
{ {
getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment substitution in " + PROFILES_XML_FILE + "." ); getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment "
+ "substitution in " + PROFILES_XML_FILE + "." );
getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e ); getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e );
} }

View File

@ -64,8 +64,8 @@ public class DefaultProfileManager
private Properties requestProperties; private Properties requestProperties;
/** /**
* @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work correctly * @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work
* in embedded envirnments. * correctly in embedded envirnments.
*/ */
public DefaultProfileManager( PlexusContainer container ) public DefaultProfileManager( PlexusContainer container )
{ {

View File

@ -88,11 +88,13 @@ public boolean isActive( Profile profile )
{ {
if ( logger.isDebugEnabled() ) if ( logger.isDebugEnabled() )
{ {
logger.debug( "Failed to interpolate missing file location for profile activator: " + fileString, e ); logger.debug( "Failed to interpolate missing file location for profile activator: " + fileString,
e );
} }
else else
{ {
logger.warn( "Failed to interpolate missing file location for profile activator: " + fileString + ". Run in debug mode (-X) for more information." ); logger.warn( "Failed to interpolate missing file location for profile activator: " + fileString
+ ". Run in debug mode (-X) for more information." );
} }
} }
} }

View File

@ -44,14 +44,7 @@ public boolean isActive( Profile profile )
{ {
try try
{ {
if ( matchJdkVersionRange( jdk ) ) return matchJdkVersionRange( jdk );
{
return true;
}
else
{
return false;
}
} }
catch ( InvalidVersionSpecificationException e ) catch ( InvalidVersionSpecificationException e )
{ {

View File

@ -24,7 +24,7 @@
@Deprecated @Deprecated
public interface ProfileActivator public interface ProfileActivator
{ {
static final String ROLE = ProfileActivator.class.getName(); final String ROLE = ProfileActivator.class.getName();
boolean canDetermineActivation( Profile profile ); boolean canDetermineActivation( Profile profile );

View File

@ -34,7 +34,8 @@ public class SystemPropertyProfileActivator
{ {
private Properties properties; private Properties properties;
public void contextualize(Context context) throws ContextException public void contextualize( Context context )
throws ContextException
{ {
properties = (Properties) context.get( "SystemProperties" ); properties = (Properties) context.get( "SystemProperties" );
} }

View File

@ -1,18 +1,22 @@
package org.apache.maven.project; package org.apache.maven.project;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;

View File

@ -1,18 +1,22 @@
package org.apache.maven.project; package org.apache.maven.project;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -37,11 +41,13 @@ MavenProject build( File project, ArtifactRepository localRepository, ProfileMan
throws ProjectBuildingException; throws ProjectBuildingException;
//TODO remote-resources-plugin //TODO remote-resources-plugin
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ProjectBuildingException; throws ProjectBuildingException;
//TODO remote-resources-plugin //TODO remote-resources-plugin
MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, boolean allowStubModel ) MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, boolean allowStubModel )
throws ProjectBuildingException; throws ProjectBuildingException;
// TODO: this is only to provide a project for plugins that don't need a project to execute but need some // TODO: this is only to provide a project for plugins that don't need a project to execute but need some

View File

@ -45,7 +45,9 @@ private ProjectUtils()
{ {
} }
public static List<ArtifactRepository> buildArtifactRepositories( List<Repository> repositories, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c ) public static List<ArtifactRepository> buildArtifactRepositories( List<Repository> repositories,
ArtifactRepositoryFactory artifactRepositoryFactory,
PlexusContainer c )
throws InvalidRepositoryException throws InvalidRepositoryException
{ {
@ -59,13 +61,17 @@ public static List<ArtifactRepository> buildArtifactRepositories( List<Repositor
return remoteRepositories; return remoteRepositories;
} }
public static ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c ) public static ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo,
ArtifactRepositoryFactory artifactRepositoryFactory,
PlexusContainer c )
throws InvalidRepositoryException throws InvalidRepositoryException
{ {
return buildArtifactRepository( repo, artifactRepositoryFactory, c ); return buildArtifactRepository( repo, artifactRepositoryFactory, c );
} }
public static ArtifactRepository buildArtifactRepository( Repository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c ) public static ArtifactRepository buildArtifactRepository( Repository repo,
ArtifactRepositoryFactory artifactRepositoryFactory,
PlexusContainer c )
throws InvalidRepositoryException throws InvalidRepositoryException
{ {
RepositorySystem repositorySystem = rs( c ); RepositorySystem repositorySystem = rs( c );

View File

@ -84,7 +84,7 @@ public void assembleBuildInheritance( Build childBuild, Build parentBuild, boole
childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() ); childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() );
} }
// Extensions are accumlated // Extensions are accumulated
mergeExtensionLists( childBuild, parentBuild ); mergeExtensionLists( childBuild, parentBuild );
if ( childBuild.getDirectory() == null ) if ( childBuild.getDirectory() == null )

View File

@ -215,7 +215,8 @@ public String interpolate( String src,
} }
} }
protected List<ValueSource> createValueSources( final Model model, final File projectDir, final ProjectBuilderConfiguration config ) protected List<ValueSource> createValueSources( final Model model, final File projectDir,
final ProjectBuilderConfiguration config )
{ {
String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT; String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT;
@ -228,7 +229,8 @@ protected List<ValueSource> createValueSources( final Model model, final File pr
ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false ); ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false );
ValueSource modelValueSource2 = new ObjectBasedValueSource( model ); ValueSource modelValueSource2 = new ObjectBasedValueSource( model );
ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){ ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
{
public Object getValue( String expression ) public Object getValue( String expression )
{ {
if ( projectDir != null && "basedir".equals( expression ) ) if ( projectDir != null && "basedir".equals( expression ) )
@ -237,9 +239,9 @@ public Object getValue( String expression )
} }
return null; return null;
} }
}, }, PROJECT_PREFIXES, true );
PROJECT_PREFIXES, true ); ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){ {
public Object getValue( String expression ) public Object getValue( String expression )
{ {
if ( projectDir != null && "baseUri".equals( expression ) ) if ( projectDir != null && "baseUri".equals( expression ) )
@ -248,8 +250,7 @@ public Object getValue( String expression )
} }
return null; return null;
} }
}, }, PROJECT_PREFIXES, false );
PROJECT_PREFIXES, false );
List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 ); List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );

View File

@ -40,7 +40,8 @@ public class PathTranslatingPostProcessor
private final PathTranslator pathTranslator; private final PathTranslator pathTranslator;
private final List<String> expressionPrefixes; private final List<String> expressionPrefixes;
public PathTranslatingPostProcessor( List<String> expressionPrefixes, List<String> unprefixedPathKeys, File projectDir, PathTranslator pathTranslator ) public PathTranslatingPostProcessor( List<String> expressionPrefixes, List<String> unprefixedPathKeys,
File projectDir, PathTranslator pathTranslator )
{ {
this.expressionPrefixes = expressionPrefixes; this.expressionPrefixes = expressionPrefixes;
this.unprefixedPathKeys = unprefixedPathKeys; this.unprefixedPathKeys = unprefixedPathKeys;

View File

@ -206,7 +206,8 @@ else if ( Collection.class.isAssignableFrom( type ) )
{ {
if ( debugEnabled && logger != null ) if ( debugEnabled && logger != null )
{ {
logger.debug( "Skipping interpolation of field: " + fields[i] + " in: " + cls.getName() + "; it is an unmodifiable collection." ); logger.debug( "Skipping interpolation of field: " + fields[i] + " in: "
+ cls.getName() + "; it is an unmodifiable collection." );
} }
continue; continue;
} }
@ -217,7 +218,11 @@ else if ( Collection.class.isAssignableFrom( type ) )
{ {
if ( String.class == value.getClass() ) if ( String.class == value.getClass() )
{ {
String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, debugEnabled ); String interpolated =
modelInterpolator.interpolateInternal( (String) value,
valueSources,
postProcessors,
debugEnabled );
if ( !interpolated.equals( value ) ) if ( !interpolated.equals( value ) )
{ {
@ -262,7 +267,11 @@ else if ( Map.class.isAssignableFrom( type ) )
{ {
if ( String.class == value.getClass() ) if ( String.class == value.getClass() )
{ {
String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, debugEnabled ); String interpolated =
modelInterpolator.interpolateInternal( (String) value,
valueSources,
postProcessors,
debugEnabled );
if ( !interpolated.equals( value ) ) if ( !interpolated.equals( value ) )
{ {
@ -274,7 +283,10 @@ else if ( Map.class.isAssignableFrom( type ) )
{ {
if ( debugEnabled && logger != null ) if ( debugEnabled && logger != null )
{ {
logger.debug( "Skipping interpolation of field: " + fields[i] + " (key: " + entry.getKey() + ") in: " + cls.getName() + "; it is an unmodifiable collection." ); logger.debug( "Skipping interpolation of field: "
+ fields[i] + " (key: " + entry.getKey() + ") in: "
+ cls.getName()
+ "; it is an unmodifiable collection." );
} }
continue; continue;
} }
@ -313,11 +325,13 @@ else if ( Map.class.isAssignableFrom( type ) )
} }
catch ( IllegalArgumentException e ) catch ( IllegalArgumentException e )
{ {
throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i]
+ " on class: " + cls.getName(), e );
} }
catch ( IllegalAccessException e ) catch ( IllegalAccessException e )
{ {
throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i]
+ " on class: " + cls.getName(), e );
} }
} }
finally finally
@ -372,7 +386,9 @@ private void evaluateArray( Object target )
{ {
if ( String.class == value.getClass() ) if ( String.class == value.getClass() )
{ {
String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, debugEnabled ); String interpolated =
modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors,
debugEnabled );
if ( !interpolated.equals( value ) ) if ( !interpolated.equals( value ) )
{ {

View File

@ -21,7 +21,6 @@
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.maven.model.Build; import org.apache.maven.model.Build;
@ -49,27 +48,21 @@ public void alignToBaseDirectory( Model model, File basedir )
build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) ); build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) );
for ( Iterator i = build.getResources().iterator(); i.hasNext(); ) for ( Resource resource : build.getResources() )
{ {
Resource resource = (Resource) i.next();
resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) );
} }
for ( Iterator i = build.getTestResources().iterator(); i.hasNext(); ) for ( Resource resource : build.getTestResources() )
{ {
Resource resource = (Resource) i.next();
resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) );
} }
if ( build.getFilters() != null ) if ( build.getFilters() != null )
{ {
List filters = new ArrayList(); List<String> filters = new ArrayList<String>();
for ( Iterator i = build.getFilters().iterator(); i.hasNext(); ) for ( String filter : build.getFilters() )
{ {
String filter = (String) i.next();
filters.add( alignToBaseDirectory( filter, basedir ) ); filters.add( alignToBaseDirectory( filter, basedir ) );
} }
build.setFilters( filters ); build.setFilters( filters );
@ -183,27 +176,21 @@ public void unalignFromBaseDirectory( Model model, File basedir )
build.setTestSourceDirectory( unalignFromBaseDirectory( build.getTestSourceDirectory(), basedir ) ); build.setTestSourceDirectory( unalignFromBaseDirectory( build.getTestSourceDirectory(), basedir ) );
for ( Iterator i = build.getResources().iterator(); i.hasNext(); ) for ( Resource resource : build.getResources() )
{ {
Resource resource = (Resource) i.next();
resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) );
} }
for ( Iterator i = build.getTestResources().iterator(); i.hasNext(); ) for ( Resource resource : build.getTestResources() )
{ {
Resource resource = (Resource) i.next();
resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) );
} }
if ( build.getFilters() != null ) if ( build.getFilters() != null )
{ {
List filters = new ArrayList(); List<String> filters = new ArrayList<String>();
for ( Iterator i = build.getFilters().iterator(); i.hasNext(); ) for ( String filter : build.getFilters() )
{ {
String filter = (String) i.next();
filters.add( unalignFromBaseDirectory( filter, basedir ) ); filters.add( unalignFromBaseDirectory( filter, basedir ) );
} }
build.setFilters( filters ); build.setFilters( filters );

View File

@ -31,7 +31,7 @@ public class ModelValidationResult
{ {
/** */ /** */
private final static String NEWLINE = System.getProperty( "line.separator" ); private static final String NEWLINE = System.getProperty( "line.separator" );
/** */ /** */
private List<String> messages; private List<String> messages;

View File

@ -131,7 +131,8 @@ static boolean isExternalRepo( ArtifactRepository originalRepository )
try try
{ {
URL url = new URL( originalRepository.getUrl() ); URL url = new URL( originalRepository.getUrl() );
return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) ); return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" )
|| url.getProtocol().equals( "file" ) );
} }
catch ( MalformedURLException e ) catch ( MalformedURLException e )
{ {

View File

@ -19,7 +19,6 @@
* under the License. * under the License.
*/ */
/** /**
* *
* *
@ -113,10 +112,9 @@ public void setScope( String scope )
@Override @Override
public String toString() public String toString()
{ {
return getGroupId()+":"+getArtifactId()+":"+getVersion() return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":"
+":" + (getClassifier() == null ? "" : getClassifier() ) + ( getClassifier() == null ? "" : getClassifier() ) + ":"
+":" + (getType() == null ? DEFAULT_TYPE : getType() ) + ( getType() == null ? DEFAULT_TYPE : getType() );
;
} }
} }

View File

@ -68,26 +68,34 @@ public MetadataGraphNode addExident( MetadataGraphNode node )
public boolean equals( Object obj ) public boolean equals( Object obj )
{ {
if ( obj == null ) if ( obj == null )
{
return false; return false;
}
if ( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) ) if ( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) )
{ {
MetadataGraphNode node2 = (MetadataGraphNode) obj; MetadataGraphNode node2 = (MetadataGraphNode) obj;
if ( node2.metadata == null ) if ( node2.metadata == null )
{
return metadata == null; return metadata == null;
}
return metadata == null ? false : metadata.toString().equals( node2.metadata.toString() ); return metadata == null ? false : metadata.toString().equals( node2.metadata.toString() );
} }
else else
{
return super.equals( obj ); return super.equals( obj );
} }
}
@Override @Override
public int hashCode() public int hashCode()
{ {
if ( metadata == null ) if ( metadata == null )
{
return super.hashCode(); return super.hashCode();
}
return metadata.toString().hashCode(); return metadata.toString().hashCode();
} }

View File

@ -65,7 +65,8 @@ public MetadataResolutionRequest()
{ {
} }
public MetadataResolutionRequest( MavenArtifactMetadata md, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) public MetadataResolutionRequest( MavenArtifactMetadata md, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
{ {
this.mad = md; this.mad = md;
this.localRepository = localRepository; this.localRepository = localRepository;

View File

@ -30,8 +30,6 @@
import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.CyclicDependencyException; import org.apache.maven.artifact.resolver.CyclicDependencyException;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector;
/** /**
* *
@ -236,7 +234,9 @@ public boolean hasErrorArtifactExceptions()
public MetadataResolutionResult addError( Exception e ) public MetadataResolutionResult addError( Exception e )
{ {
if ( exceptions == null ) if ( exceptions == null )
{
initList( exceptions ); initList( exceptions );
}
exceptions.add( e ); exceptions.add( e );

View File

@ -40,13 +40,11 @@ public class VersionNotFoundException
private File pomFile; private File pomFile;
private InvalidVersionSpecificationException cause; private InvalidVersionSpecificationException cause;
public VersionNotFoundException( String projectId public VersionNotFoundException( String projectId, Dependency dependency, File pomFile,
, Dependency dependency InvalidVersionSpecificationException cause )
, File pomFile
, InvalidVersionSpecificationException cause
)
{ {
super( projectId+", "+formatLocationInPom( dependency )+ " " +dependency.getVersion()+", pom file "+pomFile, cause ); super( projectId + ", " + formatLocationInPom( dependency ) + " " + dependency.getVersion() + ", pom file "
+ pomFile, cause );
this.projectId = projectId; this.projectId = projectId;

View File

@ -390,7 +390,8 @@ private Properties read( File touchfile )
} }
catch ( IOException e ) catch ( IOException e )
{ {
getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile, e ); getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile,
e );
} }
} }

View File

@ -53,7 +53,7 @@
//TODO: remove the update check manager //TODO: remove the update check manager
//TODO: separate into retriever and publisher //TODO: separate into retriever and publisher
//TODO: rmeove hardcoding of checksum logic //TODO: remove hardcoding of checksum logic
@Component( role = WagonManager.class ) @Component( role = WagonManager.class )
public class DefaultWagonManager public class DefaultWagonManager
implements WagonManager implements WagonManager
@ -75,7 +75,8 @@ public class DefaultWagonManager
// //
// Retriever // Retriever
// //
public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, boolean force ) public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor,
boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String remotePath = repository.pathOf( artifact ); String remotePath = repository.pathOf( artifact );
@ -138,7 +139,8 @@ else if ( !artifact.getFile().exists() )
} }
} }
public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor, boolean force ) public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories,
TransferListener downloadMonitor, boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
TransferFailedException tfe = null; TransferFailedException tfe = null;
@ -195,7 +197,8 @@ public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepos
} }
} }
public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy ) public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination,
String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );
@ -203,7 +206,8 @@ public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository r
getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
} }
public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy ) public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository,
File destination, String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );
@ -235,7 +239,8 @@ private void connectWagon( Wagon wagon, ArtifactRepository repository )
} }
else if ( repository.getAuthentication() != null ) else if ( repository.getAuthentication() != null )
{ {
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ) ); wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
authenticationInfo( repository ) );
} }
else if ( repository.getProxy() != null ) else if ( repository.getProxy() != null )
{ {
@ -267,7 +272,8 @@ private ProxyInfo proxyInfo( ArtifactRepository repository )
return proxyInfo; return proxyInfo;
} }
public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath,
TransferListener downloadMonitor, String checksumPolicy, boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String protocol = repository.getProtocol(); String protocol = repository.getProtocol();
@ -407,7 +413,8 @@ public void getRemoteFile( ArtifactRepository repository, File destination, Stri
catch ( ResourceDoesNotExistException md5TryException ) catch ( ResourceDoesNotExistException md5TryException )
{ {
// this was a failed transfer, and we don't want to retry. // this was a failed transfer, and we don't want to retry.
handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, md5TryException ); handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath,
md5TryException );
} }
} }
@ -470,7 +477,8 @@ public void getRemoteFile( ArtifactRepository repository, File destination, Stri
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new TransferFailedException( "Error copying temporary file to the final destination: " + e.getMessage(), e ); throw new TransferFailedException( "Error copying temporary file to the final destination: "
+ e.getMessage(), e );
} }
} }
} }
@ -479,7 +487,8 @@ public void getRemoteFile( ArtifactRepository repository, File destination, Stri
// //
// Publisher // Publisher
// //
public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository,
TransferListener downloadMonitor )
throws TransferFailedException throws TransferFailedException
{ {
putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor );
@ -492,7 +501,8 @@ public void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata,
putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null ); putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null );
} }
public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) public void putRemoteFile( ArtifactRepository repository, File source, String remotePath,
TransferListener downloadMonitor )
throws TransferFailedException throws TransferFailedException
{ {
String protocol = repository.getProtocol(); String protocol = repository.getProtocol();
@ -648,7 +658,8 @@ else if ( !ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksumPolic
// otherwise it is ignore // otherwise it is ignore
} }
private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, String remotePath, String checksumFileExtension, Wagon wagon ) private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination,
String remotePath, String checksumFileExtension, Wagon wagon )
throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException
{ {
try try
@ -666,7 +677,8 @@ private void verifyChecksum( ChecksumObserver checksumObserver, File destination
expectedChecksum = expectedChecksum.trim(); expectedChecksum = expectedChecksum.trim();
// check for 'ALGO (name) = CHECKSUM' like used by openssl // check for 'ALGO (name) = CHECKSUM' like used by openssl
if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) ) if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 )
|| expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) )
{ {
int lastSpacePos = expectedChecksum.lastIndexOf( ' ' ); int lastSpacePos = expectedChecksum.lastIndexOf( ' ' );
expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 ); expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 );
@ -693,7 +705,8 @@ private void verifyChecksum( ChecksumObserver checksumObserver, File destination
} }
else else
{ {
throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum + "'; remote = '" + expectedChecksum + "'" ); throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum
+ "'; remote = '" + expectedChecksum + "'" );
} }
} }
catch ( IOException e ) catch ( IOException e )

View File

@ -1,18 +1,22 @@
package org.apache.maven.repository.legacy; package org.apache.maven.repository.legacy;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -112,7 +116,8 @@ public Artifact createArtifact( String groupId, String artifactId, String versio
return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging ); return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging );
} }
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
String classifier )
{ {
return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
} }
@ -134,7 +139,9 @@ public Artifact createDependencyArtifact( Dependency d )
return null; return null;
} }
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope(), d.isOptional() ); Artifact artifact =
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(),
d.getClassifier(), d.getScope(), d.isOptional() );
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null ) if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null )
{ {
@ -225,8 +232,11 @@ public ArtifactRepository createDefaultLocalRepository()
public ArtifactRepository createLocalRepository( File localRepository ) public ArtifactRepository createLocalRepository( File localRepository )
throws InvalidRepositoryException throws InvalidRepositoryException
{ {
return createRepository( "file://" + localRepository.toURI().getRawPath(), RepositorySystem.DEFAULT_LOCAL_REPO_ID, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, return createRepository( "file://" + localRepository.toURI().getRawPath(),
ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); RepositorySystem.DEFAULT_LOCAL_REPO_ID, true,
ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
} }
public ArtifactRepository createDefaultRemoteRepository() public ArtifactRepository createDefaultRemoteRepository()
@ -241,7 +251,9 @@ public ArtifactRepository createDefaultRemoteRepository()
public ArtifactRepository createLocalRepository( String url, String repositoryId ) public ArtifactRepository createLocalRepository( String url, String repositoryId )
throws IOException throws IOException
{ {
return createRepository( canonicalFileUrl( url ), repositoryId, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, return createRepository( canonicalFileUrl( url ), repositoryId, true,
ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
} }
@ -282,11 +294,13 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
*/ */
try try
{ {
LocalArtifactRepository ideWorkspace = plexus.lookup( LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE ); LocalArtifactRepository ideWorkspace =
plexus.lookup( LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE );
if ( request.getLocalRepository() instanceof DelegatingLocalArtifactRepository ) if ( request.getLocalRepository() instanceof DelegatingLocalArtifactRepository )
{ {
DelegatingLocalArtifactRepository delegatingLocalRepository = (DelegatingLocalArtifactRepository) request.getLocalRepository(); DelegatingLocalArtifactRepository delegatingLocalRepository =
(DelegatingLocalArtifactRepository) request.getLocalRepository();
LocalArtifactRepository orig = delegatingLocalRepository.getIdeWorspace(); LocalArtifactRepository orig = delegatingLocalRepository.getIdeWorspace();
@ -304,7 +318,8 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
else else
{ {
ArtifactRepository localRepository = request.getLocalRepository(); ArtifactRepository localRepository = request.getLocalRepository();
DelegatingLocalArtifactRepository delegatingLocalRepository = new DelegatingLocalArtifactRepository( localRepository ); DelegatingLocalArtifactRepository delegatingLocalRepository =
new DelegatingLocalArtifactRepository( localRepository );
delegatingLocalRepository.setIdeWorkspace( ideWorkspace ); delegatingLocalRepository.setIdeWorkspace( ideWorkspace );
request.setLocalRepository( delegatingLocalRepository ); request.setLocalRepository( delegatingLocalRepository );
try try
@ -370,7 +385,8 @@ public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepositor
for ( List<ArtifactRepository> aliasedRepos : reposByKey.values() ) for ( List<ArtifactRepository> aliasedRepos : reposByKey.values() )
{ {
List<ArtifactRepositoryPolicy> releasePolicies = new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() ); List<ArtifactRepositoryPolicy> releasePolicies =
new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
for ( ArtifactRepository aliasedRepo : aliasedRepos ) for ( ArtifactRepository aliasedRepo : aliasedRepos )
{ {
@ -379,7 +395,8 @@ public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepositor
ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy( releasePolicies ); ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy( releasePolicies );
List<ArtifactRepositoryPolicy> snapshotPolicies = new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() ); List<ArtifactRepositoryPolicy> snapshotPolicies =
new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() );
for ( ArtifactRepository aliasedRepo : aliasedRepos ) for ( ArtifactRepository aliasedRepo : aliasedRepos )
{ {
@ -391,7 +408,8 @@ public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepositor
ArtifactRepository aliasedRepo = aliasedRepos.get( 0 ); ArtifactRepository aliasedRepo = aliasedRepos.get( 0 );
ArtifactRepository effectiveRepository = ArtifactRepository effectiveRepository =
createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), snapshotPolicy, releasePolicy ); createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(),
snapshotPolicy, releasePolicy );
effectiveRepository.setAuthentication( aliasedRepo.getAuthentication() ); effectiveRepository.setAuthentication( aliasedRepo.getAuthentication() );
@ -571,7 +589,8 @@ public MetadataResolutionResult resolveMetadata( MetadataResolutionRequest reque
return null; return null;
} }
public void retrieve( ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener ) public void retrieve( ArtifactRepository repository, File destination, String remotePath,
ArtifactTransferListener transferListener )
throws ArtifactTransferFailedException, ArtifactDoesNotExistException throws ArtifactTransferFailedException, ArtifactDoesNotExistException
{ {
try try
@ -590,7 +609,8 @@ public void retrieve( ArtifactRepository repository, File destination, String re
} }
} }
public void publish( ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener ) public void publish( ArtifactRepository repository, File source, String remotePath,
ArtifactTransferListener transferListener )
throws ArtifactTransferFailedException throws ArtifactTransferFailedException
{ {
try try
@ -638,23 +658,32 @@ public ArtifactRepository buildArtifactRepository( Repository repo )
} }
} }
private ArtifactRepository createRepository( String url, String repositoryId, boolean releases, String releaseUpdates, boolean snapshots, String snapshotUpdates, String checksumPolicy ) private ArtifactRepository createRepository( String url, String repositoryId, boolean releases,
String releaseUpdates, boolean snapshots, String snapshotUpdates,
String checksumPolicy )
{ {
ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy ); ArtifactRepositoryPolicy snapshotsPolicy =
new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy );
ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy ); ArtifactRepositoryPolicy releasesPolicy =
new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy );
return createArtifactRepository( repositoryId, url, null, snapshotsPolicy, releasesPolicy ); return createArtifactRepository( repositoryId, url, null, snapshotsPolicy, releasesPolicy );
} }
public ArtifactRepository createArtifactRepository( String repositoryId, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) public ArtifactRepository createArtifactRepository( String repositoryId, String url,
ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases )
{ {
if ( repositoryLayout == null ) if ( repositoryLayout == null )
{ {
repositoryLayout = layouts.get( "default" ); repositoryLayout = layouts.get( "default" );
} }
ArtifactRepository artifactRepository = artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots, releases ); ArtifactRepository artifactRepository =
artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots,
releases );
return artifactRepository; return artifactRepository;
} }

View File

@ -1,18 +1,22 @@
package org.apache.maven.repository.legacy; package org.apache.maven.repository.legacy;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -21,7 +25,6 @@
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.UnsupportedProtocolException; import org.apache.maven.wagon.UnsupportedProtocolException;
@ -45,22 +48,27 @@ Wagon getWagon( Repository repository )
void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force ) void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force )
throws TransferFailedException, ResourceDoesNotExistException; throws TransferFailedException, ResourceDoesNotExistException;
void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener transferListener, boolean force ) void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories,
TransferListener transferListener, boolean force )
throws TransferFailedException, ResourceDoesNotExistException; throws TransferFailedException, ResourceDoesNotExistException;
void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) void getRemoteFile( ArtifactRepository repository, File destination, String remotePath,
TransferListener downloadMonitor, String checksumPolicy, boolean force )
throws TransferFailedException, ResourceDoesNotExistException; throws TransferFailedException, ResourceDoesNotExistException;
void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, String checksumPolicy ) void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination,
String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException; throws TransferFailedException, ResourceDoesNotExistException;
void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn ) void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository,
File file, String checksumPolicyWarn )
throws TransferFailedException, ResourceDoesNotExistException; throws TransferFailedException, ResourceDoesNotExistException;
// //
// Deployer // Deployer
// //
void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository,
TransferListener downloadMonitor )
throws TransferFailedException; throws TransferFailedException;
void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor )

View File

@ -1,18 +1,22 @@
package org.apache.maven.repository.legacy.repository; package org.apache.maven.repository.legacy.repository;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import org.apache.maven.artifact.UnknownRepositoryLayoutException; import org.apache.maven.artifact.UnknownRepositoryLayoutException;
@ -36,12 +40,15 @@ ArtifactRepositoryLayout getLayout( String layoutId )
ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ); ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
boolean uniqueVersion );
ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) ArtifactRepository createArtifactRepository( String id, String url, String layoutId,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
throws UnknownRepositoryLayoutException; throws UnknownRepositoryLayoutException;
ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases );
void setGlobalUpdatePolicy( String snapshotPolicy ); void setGlobalUpdatePolicy( String snapshotPolicy );

View File

@ -51,9 +51,7 @@ public ArtifactRepositoryLayout getLayout( String layoutId )
return repositoryLayouts.get( layoutId ); return repositoryLayouts.get( layoutId );
} }
public ArtifactRepository createDeploymentArtifactRepository( String id, public ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId,
String url,
String layoutId,
boolean uniqueVersion ) boolean uniqueVersion )
throws UnknownRepositoryLayoutException throws UnknownRepositoryLayoutException
{ {
@ -64,9 +62,7 @@ public ArtifactRepository createDeploymentArtifactRepository( String id,
return createDeploymentArtifactRepository( id, url, layout, uniqueVersion ); return createDeploymentArtifactRepository( id, url, layout, uniqueVersion );
} }
private void checkLayout( String repositoryId, private void checkLayout( String repositoryId, String layoutId, ArtifactRepositoryLayout layout )
String layoutId,
ArtifactRepositoryLayout layout )
throws UnknownRepositoryLayoutException throws UnknownRepositoryLayoutException
{ {
if ( layout == null ) if ( layout == null )
@ -75,17 +71,14 @@ private void checkLayout( String repositoryId,
} }
} }
public ArtifactRepository createDeploymentArtifactRepository( String id, public ArtifactRepository createDeploymentArtifactRepository( String id, String url,
String url,
ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryLayout repositoryLayout,
boolean uniqueVersion ) boolean uniqueVersion )
{ {
return createArtifactRepository( id, url, repositoryLayout, null, null ); return createArtifactRepository( id, url, repositoryLayout, null, null );
} }
public ArtifactRepository createArtifactRepository( String id, public ArtifactRepository createArtifactRepository( String id, String url, String layoutId,
String url,
String layoutId,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases ) ArtifactRepositoryPolicy releases )
throws UnknownRepositoryLayoutException throws UnknownRepositoryLayoutException
@ -97,8 +90,7 @@ public ArtifactRepository createArtifactRepository( String id,
return createArtifactRepository( id, url, layout, snapshots, releases ); return createArtifactRepository( id, url, layout, snapshots, releases );
} }
public ArtifactRepository createArtifactRepository( String id, public ArtifactRepository createArtifactRepository( String id, String url,
String url,
ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases ) ArtifactRepositoryPolicy releases )

View File

@ -87,13 +87,10 @@ private void injectSession( ArtifactResolutionRequest request )
} }
} }
public ArtifactResolutionResult collect( Set<Artifact> artifacts, public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
Map managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactMetadataSource source, ArtifactFilter filter,
ArtifactFilter filter,
List<ResolutionListener> listeners, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers ) List<ConflictResolver> conflictResolvers )
{ {
@ -105,12 +102,9 @@ public ArtifactResolutionResult collect( Set<Artifact> artifacts,
conflictResolvers ); conflictResolvers );
} }
public ArtifactResolutionResult collect( Set<Artifact> artifacts, public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
Artifact originatingArtifact, Map managedVersions, ArtifactResolutionRequest repositoryRequest,
Map managedVersions, ArtifactMetadataSource source, ArtifactFilter filter,
ArtifactResolutionRequest repositoryRequest,
ArtifactMetadataSource source,
ArtifactFilter filter,
List<ResolutionListener> listeners, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers ) List<ConflictResolver> conflictResolvers )
{ {
@ -148,7 +142,8 @@ public ArtifactResolutionResult collect( Set<Artifact> artifacts,
try try
{ {
recurse( result, root, resolvedArtifacts, versionMap, repositoryRequest, source, filter, listeners, conflictResolvers ); recurse( result, root, resolvedArtifacts, versionMap, repositoryRequest, source, filter, listeners,
conflictResolvers );
} }
catch ( CyclicDependencyException e ) catch ( CyclicDependencyException e )
{ {
@ -242,15 +237,10 @@ private ManagedVersionMap getManagedVersionsMap( Artifact originatingArtifact, M
return versionMap; return versionMap;
} }
private void recurse( ArtifactResolutionResult result, private void recurse( ArtifactResolutionResult result, ResolutionNode node,
ResolutionNode node, Map<Object, List<ResolutionNode>> resolvedArtifacts, ManagedVersionMap managedVersions,
Map<Object, List<ResolutionNode>> resolvedArtifacts, ArtifactResolutionRequest request, ArtifactMetadataSource source, ArtifactFilter filter,
ManagedVersionMap managedVersions, List<ResolutionListener> listeners, List<ConflictResolver> conflictResolvers )
ArtifactResolutionRequest request,
ArtifactMetadataSource source,
ArtifactFilter filter,
List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers )
throws ArtifactResolutionException throws ArtifactResolutionException
{ {
fireEvent( ResolutionListener.TEST_ARTIFACT, listeners, node ); fireEvent( ResolutionListener.TEST_ARTIFACT, listeners, node );
@ -324,13 +314,17 @@ private void recurse( ArtifactResolutionResult result,
catch ( ArtifactMetadataRetrievalException e ) catch ( ArtifactMetadataRetrievalException e )
{ {
resetArtifact.setDependencyTrail( node.getDependencyTrail() ); resetArtifact.setDependencyTrail( node.getDependencyTrail() );
throw new ArtifactResolutionException( "Unable to get dependency information: " + e.getMessage(), resetArtifact, request.getRemoteRepositories(), e ); throw new ArtifactResolutionException(
"Unable to get dependency information: "
+ e.getMessage(), resetArtifact,
request.getRemoteRepositories(), e );
} }
} }
// end hack // end hack
// MNG-2861: match version can return null // MNG-2861: match version can return null
ArtifactVersion selectedVersion = resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() ); ArtifactVersion selectedVersion =
resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() );
if ( selectedVersion != null ) if ( selectedVersion != null )
{ {
resetArtifact.selectVersion( selectedVersion.toString() ); resetArtifact.selectVersion( selectedVersion.toString() );
@ -359,15 +353,19 @@ private void recurse( ArtifactResolutionResult result,
if ( resolved == null ) if ( resolved == null )
{ {
// TODO: add better exception that can detail the two conflicting artifacts // TODO: add better exception that can detail the two conflicting artifacts
ArtifactResolutionException are = new ArtifactResolutionException( "Cannot resolve artifact version conflict between " + previous.getArtifact().getVersion() ArtifactResolutionException are =
+ " and " + node.getArtifact().getVersion(), previous.getArtifact() ); new ArtifactResolutionException( "Cannot resolve artifact version conflict between "
+ previous.getArtifact().getVersion() + " and " + node.getArtifact().getVersion(),
previous.getArtifact() );
result.addVersionRangeViolation( are ); result.addVersionRangeViolation( are );
} }
if ( ( resolved != previous ) && ( resolved != node ) ) if ( ( resolved != previous ) && ( resolved != node ) )
{ {
// TODO: add better exception // TODO: add better exception
result.addVersionRangeViolation( new ArtifactResolutionException( "Conflict resolver returned unknown resolution node: ", resolved.getArtifact() ) ); result.addVersionRangeViolation( new ArtifactResolutionException(
"Conflict resolver returned unknown resolution node: ",
resolved.getArtifact() ) );
} }
// TODO: should this be part of mediation? // TODO: should this be part of mediation?
@ -513,7 +511,8 @@ private void recurse( ArtifactResolutionResult result,
{ {
throw new OverConstrainedVersionException( throw new OverConstrainedVersionException(
"No versions are present in the repository for the artifact with a range " "No versions are present in the repository for the artifact with a range "
+ versionRange, artifact, + versionRange,
artifact,
childRemoteRepositories ); childRemoteRepositories );
} }
@ -601,7 +600,8 @@ private void recurse( ArtifactResolutionResult result,
} }
} }
private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions, List<ResolutionListener> listeners ) private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions,
List<ResolutionListener> listeners )
{ {
Artifact artifact = (Artifact) managedVersions.get( node.getKey() ); Artifact artifact = (Artifact) managedVersions.get( node.getKey() );
@ -649,7 +649,8 @@ boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List<
/* farthest is runtime and nearest has lower priority, change to runtime */ /* farthest is runtime and nearest has lower priority, change to runtime */
if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() ) if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() )
&& ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) ) && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() )
|| Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) )
{ {
updateScope = true; updateScope = true;
} }

View File

@ -26,7 +26,6 @@
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionListener; import org.apache.maven.artifact.resolver.ResolutionListener;
@ -44,24 +43,15 @@
public interface LegacyArtifactCollector public interface LegacyArtifactCollector
{ {
ArtifactResolutionResult collect( Set<Artifact> artifacts, ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
Artifact originatingArtifact, ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source,
Map managedVersions, ArtifactFilter filter, List<ResolutionListener> listeners,
ArtifactResolutionRequest repositoryRequest,
ArtifactMetadataSource source,
ArtifactFilter filter,
List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers ); List<ConflictResolver> conflictResolvers );
ArtifactResolutionResult collect( Set<Artifact> artifacts, ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
Map managedVersions, ArtifactMetadataSource source, ArtifactFilter filter,
ArtifactRepository localRepository, List<ResolutionListener> listeners, List<ConflictResolver> conflictResolvers );
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source,
ArtifactFilter filter,
List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers );
// used by maven-dependency-tree and maven-dependency-plugin // used by maven-dependency-tree and maven-dependency-plugin
@Deprecated @Deprecated

View File

@ -30,7 +30,7 @@
*/ */
public interface ConflictResolver public interface ConflictResolver
{ {
static String ROLE = ConflictResolver.class.getName(); String ROLE = ConflictResolver.class.getName();
/** /**
* Determines which of the specified versions of an artifact to use when there are conflicting declarations. * Determines which of the specified versions of an artifact to use when there are conflicting declarations.
@ -41,6 +41,5 @@ public interface ConflictResolver
* this conflict cannot be resolved * this conflict cannot be resolved
* @since 3.0 * @since 3.0
*/ */
ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 );
ResolutionNode node2 );
} }

View File

@ -1,7 +1,5 @@
package org.apache.maven.repository.legacy.resolver.conflict; package org.apache.maven.repository.legacy.resolver.conflict;
import org.codehaus.plexus.component.annotations.Component;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -21,6 +19,8 @@
* under the License. * under the License.
*/ */
import org.codehaus.plexus.component.annotations.Component;
/** /**
* The default conflict resolver that delegates to the nearest strategy. * The default conflict resolver that delegates to the nearest strategy.
* *

View File

@ -38,8 +38,7 @@
*/ */
@Component( role = ConflictResolverFactory.class ) @Component( role = ConflictResolverFactory.class )
public class DefaultConflictResolverFactory public class DefaultConflictResolverFactory
implements ConflictResolverFactory, implements ConflictResolverFactory, Contextualizable
Contextualizable
{ {
// fields ----------------------------------------------------------------- // fields -----------------------------------------------------------------

View File

@ -41,8 +41,7 @@ public class FarthestConflictResolver
* org.apache.maven.artifact.resolver.ResolutionNode) * org.apache.maven.artifact.resolver.ResolutionNode)
*/ */
public ResolutionNode resolveConflict( ResolutionNode node1, public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
ResolutionNode node2 )
{ {
return node1.getDepth() >= node2.getDepth() ? node1 : node2; return node1.getDepth() >= node2.getDepth() ? node1 : node2;
} }

View File

@ -42,8 +42,7 @@ public class NearestConflictResolver
* org.apache.maven.artifact.resolver.ResolutionNode) * org.apache.maven.artifact.resolver.ResolutionNode)
*/ */
public ResolutionNode resolveConflict( ResolutionNode node1, public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
ResolutionNode node2 )
{ {
return node1.getDepth() <= node2.getDepth() ? node1 : node2; return node1.getDepth() <= node2.getDepth() ? node1 : node2;
} }

View File

@ -44,8 +44,7 @@ public class NewestConflictResolver
* org.apache.maven.artifact.resolver.ResolutionNode) * org.apache.maven.artifact.resolver.ResolutionNode)
*/ */
public ResolutionNode resolveConflict( ResolutionNode node1, public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
ResolutionNode node2 )
{ {
try try
{ {

View File

@ -44,8 +44,7 @@ public class OldestConflictResolver
* org.apache.maven.artifact.resolver.ResolutionNode) * org.apache.maven.artifact.resolver.ResolutionNode)
*/ */
public ResolutionNode resolveConflict( ResolutionNode node1, public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
ResolutionNode node2 )
{ {
try try
{ {

View File

@ -36,7 +36,7 @@ public interface ArtifactTransformationManager
/** /**
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
* transformation has occured the original artifact is returned. * transformation has occurred the original artifact is returned.
* *
* @param artifact Artifact to be transformed. * @param artifact Artifact to be transformed.
* @param request the repositories to check * @param request the repositories to check
@ -47,18 +47,19 @@ void transformForResolve( Artifact artifact, RepositoryRequest request )
/** /**
* Take in a artifact and return the transformed artifact for locating in the remote repository. If no * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
* transformation has occured the original artifact is returned. * transformation has occurred the original artifact is returned.
* *
* @param artifact Artifact to be transformed. * @param artifact Artifact to be transformed.
* @param remoteRepositories the repositories to check * @param remoteRepositories the repositories to check
* @param localRepository the local repository * @param localRepository the local repository
*/ */
void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
/** /**
* Take in a artifact and return the transformed artifact for locating in the local repository. If no * Take in a artifact and return the transformed artifact for locating in the local repository. If no
* transformation has occured the original artifact is returned. * transformation has occurred the original artifact is returned.
* *
* @param artifact Artifact to be transformed. * @param artifact Artifact to be transformed.
* @param localRepository the local repository it will be stored in * @param localRepository the local repository it will be stored in
@ -68,13 +69,14 @@ void transformForInstall( Artifact artifact, ArtifactRepository localRepository
/** /**
* Take in a artifact and return the transformed artifact for distributing to a remote repository. If no * Take in a artifact and return the transformed artifact for distributing to a remote repository. If no
* transformation has occured the original artifact is returned. * transformation has occurred the original artifact is returned.
* *
* @param artifact Artifact to be transformed. * @param artifact Artifact to be transformed.
* @param remoteRepository the repository to deploy to * @param remoteRepository the repository to deploy to
* @param localRepository the local repository the metadata is stored in * @param localRepository the local repository the metadata is stored in
*/ */
void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;
List getArtifactTransformations(); List getArtifactTransformations();

View File

@ -50,8 +50,7 @@ public void transformForResolve( Artifact artifact, RepositoryRequest request )
} }
} }
public void transformForResolve( Artifact artifact, public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException throws ArtifactResolutionException, ArtifactNotFoundException
{ {
@ -61,8 +60,7 @@ public void transformForResolve( Artifact artifact,
} }
} }
public void transformForInstall( Artifact artifact, public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
ArtifactRepository localRepository )
throws ArtifactInstallationException throws ArtifactInstallationException
{ {
for ( ArtifactTransformation transform : artifactTransformations ) for ( ArtifactTransformation transform : artifactTransformations )
@ -71,8 +69,7 @@ public void transformForInstall( Artifact artifact,
} }
} }
public void transformForDeployment( Artifact artifact, public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
ArtifactRepository remoteRepository,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {

View File

@ -56,21 +56,18 @@ public void transformForResolve( Artifact artifact, RepositoryRequest request )
} }
} }
public void transformForInstall( Artifact artifact, public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
{
// metadata is added via addPluginArtifactMetadata
}
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
{ {
// metadata is added via addPluginArtifactMetadata // metadata is added via addPluginArtifactMetadata
} }
public void transformForDeployment( Artifact artifact, protected String constructVersion( Versioning versioning, String baseVersion )
ArtifactRepository remoteRepository,
ArtifactRepository localRepository )
{
// metadata is added via addPluginArtifactMetadata
}
protected String constructVersion( Versioning versioning,
String baseVersion )
{ {
return versioning.getLatest(); return versioning.getLatest();
} }

View File

@ -65,16 +65,14 @@ public void transformForResolve( Artifact artifact, RepositoryRequest request )
} }
} }
public void transformForInstall( Artifact artifact, public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
ArtifactRepository localRepository )
{ {
ArtifactMetadata metadata = createMetadata( artifact ); ArtifactMetadata metadata = createMetadata( artifact );
artifact.addMetadata( metadata ); artifact.addMetadata( metadata );
} }
public void transformForDeployment( Artifact artifact, public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
ArtifactRepository remoteRepository,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
{ {
ArtifactMetadata metadata = createMetadata( artifact ); ArtifactMetadata metadata = createMetadata( artifact );
@ -96,8 +94,7 @@ private ArtifactMetadata createMetadata( Artifact artifact )
return new ArtifactRepositoryMetadata( artifact, versioning ); return new ArtifactRepositoryMetadata( artifact, versioning );
} }
protected String constructVersion( Versioning versioning, protected String constructVersion( Versioning versioning, String baseVersion )
String baseVersion )
{ {
return versioning.getRelease(); return versioning.getRelease();
} }

View File

@ -71,8 +71,7 @@ public void transformForResolve( Artifact artifact, RepositoryRequest request )
} }
} }
public void transformForInstall( Artifact artifact, public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
ArtifactRepository localRepository )
{ {
if ( artifact.isSnapshot() ) if ( artifact.isSnapshot() )
{ {
@ -84,8 +83,7 @@ public void transformForInstall( Artifact artifact,
} }
} }
public void transformForDeployment( Artifact artifact, public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
ArtifactRepository remoteRepository,
ArtifactRepository localRepository ) ArtifactRepository localRepository )
throws ArtifactDeploymentException throws ArtifactDeploymentException
{ {
@ -126,8 +124,7 @@ public String getDeploymentTimestamp()
return deploymentTimestamp; return deploymentTimestamp;
} }
protected String constructVersion( Versioning versioning, protected String constructVersion( Versioning versioning, String baseVersion )
String baseVersion )
{ {
String version = null; String version = null;
Snapshot snapshot = versioning.getSnapshot(); Snapshot snapshot = versioning.getSnapshot();
@ -146,8 +143,7 @@ protected String constructVersion( Versioning versioning,
return version; return version;
} }
private int resolveLatestSnapshotBuildNumber( Artifact artifact, private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository,
ArtifactRepository localRepository,
ArtifactRepository remoteRepository ) ArtifactRepository remoteRepository )
throws RepositoryMetadataResolutionException throws RepositoryMetadataResolutionException
{ {

View File

@ -1,5 +1,24 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Collection; import java.util.Collection;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
@ -53,12 +72,16 @@ public class ArtifactMetadata
public ArtifactMetadata( String name ) public ArtifactMetadata( String name )
{ {
if ( name == null ) if ( name == null )
{
return; return;
}
int ind1 = name.indexOf( ':' ); int ind1 = name.indexOf( ':' );
int ind2 = name.lastIndexOf( ':' ); int ind2 = name.lastIndexOf( ':' );
if ( ind1 == -1 || ind2 == -1 ) if ( ind1 == -1 || ind2 == -1 )
{
return; return;
}
this.groupId = name.substring( 0, ind1 ); this.groupId = name.substring( 0, ind1 );
if ( ind1 == ind2 ) if ( ind1 == ind2 )
@ -73,65 +96,37 @@ public ArtifactMetadata( String name )
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
public ArtifactMetadata( String groupId, public ArtifactMetadata( String groupId, String name, String version )
String name,
String version )
{ {
this( groupId, name, version, null ); this( groupId, name, version, null );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId, public ArtifactMetadata( String groupId, String name, String version, String type )
String name,
String version,
String type )
{ {
this( groupId, name, version, type, null ); this( groupId, name, version, type, null );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId, public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope )
String name,
String version,
String type,
ArtifactScopeEnum artifactScope )
{ {
this( groupId, name, version, type, artifactScope, null ); this( groupId, name, version, type, artifactScope, null );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId, public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope,
String name,
String version,
String type,
ArtifactScopeEnum artifactScope,
String classifier ) String classifier )
{ {
this( groupId, name, version, type, artifactScope, classifier, null ); this( groupId, name, version, type, artifactScope, classifier, null );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId, public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope,
String name, String classifier, String artifactUri )
String version,
String type,
ArtifactScopeEnum artifactScope,
String classifier
, String artifactUri
)
{ {
this( groupId, name, version, type, artifactScope, classifier, artifactUri, null, true, null ); this( groupId, name, version, type, artifactScope, classifier, artifactUri, null, true, null );
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope,
, String name String classifier, String artifactUri, String why, boolean resolved, String error )
, String version
, String type
, ArtifactScopeEnum artifactScope
, String classifier
, String artifactUri
, String why
, boolean resolved
, String error
)
{ {
this.groupId = groupId; this.groupId = groupId;
this.artifactId = name; this.artifactId = name;
@ -145,29 +140,12 @@ public ArtifactMetadata( String groupId
this.error = error; this.error = error;
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public ArtifactMetadata( String groupId public ArtifactMetadata( String groupId, String name, String version, String type, String scopeString,
, String name String classifier, String artifactUri, String why, boolean resolved, String error )
, String version
, String type
, String scopeString
, String classifier
, String artifactUri
, String why
, boolean resolved
, String error
)
{ {
this( groupId this( groupId, name, version, type,
, name scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scopeString ),
, version classifier, artifactUri, why, resolved, error );
, type
, scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf(scopeString)
, classifier
, artifactUri
, why
, resolved
, error
);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -265,10 +243,7 @@ public void setArtifactScope( ArtifactScopeEnum artifactScope )
public void setScope( String scope ) public void setScope( String scope )
{ {
this.artifactScope = scope == null this.artifactScope = scope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scope );
? ArtifactScopeEnum.DEFAULT_SCOPE
: ArtifactScopeEnum.valueOf( scope )
;
} }
public String getClassifier() public String getClassifier()

View File

@ -1,7 +1,25 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
import org.apache.maven.artifact.ArtifactScopeEnum; /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.artifact.ArtifactScopeEnum;
/** /**
* Helper class to conver an Md Graph into some form of a classpath * Helper class to conver an Md Graph into some form of a classpath
@ -23,8 +41,6 @@ public interface ClasspathTransformation
* @return Collection of metadata objects in the linked subgraph of the graph which * @return Collection of metadata objects in the linked subgraph of the graph which
* contains the graph.getEntry() vertice * contains the graph.getEntry() vertice
*/ */
ClasspathContainer transform( MetadataGraph dirtyGraph, ClasspathContainer transform( MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve )
ArtifactScopeEnum scope,
boolean resolve)
throws MetadataGraphTransformationException; throws MetadataGraphTransformationException;
} }

View File

@ -49,20 +49,30 @@ public MetadataGraph resolveConflicts( MetadataGraph graph, ArtifactScopeEnum sc
throws GraphConflictResolutionException throws GraphConflictResolutionException
{ {
if ( policy == null ) if ( policy == null )
{
throw new GraphConflictResolutionException( "no GraphConflictResolutionPolicy injected" ); throw new GraphConflictResolutionException( "no GraphConflictResolutionPolicy injected" );
}
if ( graph == null ) if ( graph == null )
{
return null; return null;
}
final MetadataGraphVertex entry = graph.getEntry(); final MetadataGraphVertex entry = graph.getEntry();
if ( entry == null ) if ( entry == null )
{
return null; return null;
}
if ( graph.isEmpty() ) if ( graph.isEmpty() )
{
throw new GraphConflictResolutionException( "graph with an entry, but not vertices do not exist" ); throw new GraphConflictResolutionException( "graph with an entry, but not vertices do not exist" );
}
if ( graph.isEmptyEdges() ) if ( graph.isEmptyEdges() )
{
return null; // no edges - nothing to worry about return null; // no edges - nothing to worry about
}
final TreeSet<MetadataGraphVertex> vertices = graph.getVertices(); final TreeSet<MetadataGraphVertex> vertices = graph.getVertices();
@ -70,7 +80,9 @@ public MetadataGraph resolveConflicts( MetadataGraph graph, ArtifactScopeEnum sc
{ {
// edge case - single vertex graph // edge case - single vertex graph
if ( vertices.size() == 1 ) if ( vertices.size() == 1 )
{
return new MetadataGraph( entry ); return new MetadataGraph( entry );
}
final ArtifactScopeEnum requestedScope = ArtifactScopeEnum.checkScope( scope ); final ArtifactScopeEnum requestedScope = ArtifactScopeEnum.checkScope( scope );
@ -138,7 +150,9 @@ public MetadataGraph resolveConflicts( MetadataGraph graph, ArtifactScopeEnum sc
private MetadataGraph findLinkedSubgraph( MetadataGraph g ) private MetadataGraph findLinkedSubgraph( MetadataGraph g )
{ {
if ( g.getVertices().size() == 1 ) if ( g.getVertices().size() == 1 )
{
return g; return g;
}
List<MetadataGraphVertex> visited = new ArrayList<MetadataGraphVertex>( g.getVertices().size() ); List<MetadataGraphVertex> visited = new ArrayList<MetadataGraphVertex>( g.getVertices().size() );
visit( g.getEntry(), visited, g ); visit( g.getEntry(), visited, g );
@ -149,11 +163,15 @@ private MetadataGraph findLinkedSubgraph( MetadataGraph g )
for ( MetadataGraphVertex v : g.getVertices() ) for ( MetadataGraphVertex v : g.getVertices() )
{ {
if ( !visited.contains( v ) ) if ( !visited.contains( v ) )
{
dropList.add( v ); dropList.add( v );
} }
}
if ( dropList.size() < 1 ) if ( dropList.size() < 1 )
{
return g; return g;
}
// now - drop vertices // now - drop vertices
TreeSet<MetadataGraphVertex> vertices = g.getVertices(); TreeSet<MetadataGraphVertex> vertices = g.getVertices();
@ -169,7 +187,9 @@ private MetadataGraph findLinkedSubgraph( MetadataGraph g )
private void visit( MetadataGraphVertex from, List<MetadataGraphVertex> visited, MetadataGraph graph ) private void visit( MetadataGraphVertex from, List<MetadataGraphVertex> visited, MetadataGraph graph )
{ {
if ( visited.contains( from ) ) if ( visited.contains( from ) )
{
return; return;
}
visited.add( from ); visited.add( from );
@ -185,16 +205,21 @@ private void visit( MetadataGraphVertex from, List<MetadataGraphVertex> visited,
} }
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List<MetadataGraphEdge> edges, ArtifactScopeEnum scope ) private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List<MetadataGraphEdge> edges,
ArtifactScopeEnum scope )
{ {
if ( edges == null || edges.isEmpty() ) if ( edges == null || edges.isEmpty() )
{
return null; return null;
}
if ( edges.size() == 1 ) if ( edges.size() == 1 )
{ {
MetadataGraphEdge e = edges.get( 0 ); MetadataGraphEdge e = edges.get( 0 );
if ( scope.encloses( e.getScope() ) ) if ( scope.encloses( e.getScope() ) )
{
return e; return e;
}
return null; return null;
} }
@ -204,13 +229,19 @@ private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List<MetadataGraphE
for ( MetadataGraphEdge e : edges ) for ( MetadataGraphEdge e : edges )
{ {
if ( !scope.encloses( e.getScope() ) ) if ( !scope.encloses( e.getScope() ) )
{
continue; continue;
}
if ( res == null ) if ( res == null )
{
res = e; res = e;
}
else else
{
res = policy.apply( e, res ); res = policy.apply( e, res );
} }
}
return res; return res;
} }

View File

@ -1,12 +1,30 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/** /**
* *
* @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a>
* *
* @version $Id$ * @version $Id$
*/ */
public class GraphConflictResolutionException public class GraphConflictResolutionException
extends Exception extends Exception
{ {

View File

@ -1,5 +1,23 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/** /**
* MetadataGraph edge selection policy. Complements * MetadataGraph edge selection policy. Complements
@ -12,10 +30,7 @@
public interface GraphConflictResolutionPolicy public interface GraphConflictResolutionPolicy
{ {
static String ROLE = GraphConflictResolutionPolicy.class.getName(); String ROLE = GraphConflictResolutionPolicy.class.getName();
public MetadataGraphEdge apply( MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 );
MetadataGraphEdge e1
, MetadataGraphEdge e2
);
} }

View File

@ -30,7 +30,7 @@
*/ */
public interface GraphConflictResolver public interface GraphConflictResolver
{ {
static String ROLE = GraphConflictResolver.class.getName(); String ROLE = GraphConflictResolver.class.getName();
/** /**
* Cleanses the supplied graph by leaving only one directed versioned edge\ * Cleanses the supplied graph by leaving only one directed versioned edge\

View File

@ -33,7 +33,6 @@
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a> * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
* *
*/ */
public class MetadataGraph public class MetadataGraph
{ {
public static final int DEFAULT_VERTICES = 32; public static final int DEFAULT_VERTICES = 32;
@ -129,11 +128,7 @@ public MetadataGraph( MetadataTreeNode tree, boolean versionedVertices, boolean
processTreeNodes( null, tree, 0, 0 ); processTreeNodes( null, tree, 0, 0 );
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
private void processTreeNodes( MetadataGraphVertex parentVertex private void processTreeNodes( MetadataGraphVertex parentVertex, MetadataTreeNode node, int depth, int pomOrder )
, MetadataTreeNode node
, int depth
, int pomOrder
)
throws MetadataResolutionException throws MetadataResolutionException
{ {
if ( node == null ) if ( node == null )
@ -150,7 +145,8 @@ private void processTreeNodes( MetadataGraphVertex parentVertex
if ( parentVertex != null ) // then create the edge if ( parentVertex != null ) // then create the edge
{ {
ArtifactMetadata md = node.getMd(); ArtifactMetadata md = node.getMd();
MetadataGraphEdge e = new MetadataGraphEdge( md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder ); MetadataGraphEdge e =
new MetadataGraphEdge( md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder );
addEdge( parentVertex, vertex, e ); addEdge( parentVertex, vertex, e );
} }
else else

View File

@ -1,7 +1,25 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
import org.apache.maven.artifact.ArtifactScopeEnum; /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.artifact.ArtifactScopeEnum;
/** /**
* metadata graph edge - combination of version, scope and depth define * metadata graph edge - combination of version, scope and depth define
@ -30,13 +48,8 @@ public class MetadataGraphEdge
MetadataGraphVertex target; MetadataGraphVertex target;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
public MetadataGraphEdge( String version public MetadataGraphEdge( String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth,
, boolean resolved int pomOrder )
, ArtifactScopeEnum scope
, String artifactUri
, int depth
, int pomOrder
)
{ {
super(); super();
this.version = version; this.version = version;
@ -50,16 +63,13 @@ public MetadataGraphEdge( String version
/** /**
* helper for equals * helper for equals
*/ */
private static boolean objectsEqual( Object o1, private static boolean objectsEqual( Object o1, Object o2 )
Object o2 )
{ {
if ( o1 == null && o2 == null ) if ( o1 == null && o2 == null )
{ {
return true; return true;
} }
if ( ( o1 == null && o2 != null ) if ( ( o1 == null && o2 != null ) || ( o1 != null && o2 == null ) )
|| ( o1 != null && o2 == null )
)
{ {
return false; return false;
} }
@ -77,13 +87,9 @@ public boolean equals( Object o )
{ {
MetadataGraphEdge e = (MetadataGraphEdge) o; MetadataGraphEdge e = (MetadataGraphEdge) o;
return return objectsEqual( version, e.version )
objectsEqual( version, e.version ) && ArtifactScopeEnum.checkScope( scope ).getScope().equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() )
&& ArtifactScopeEnum.checkScope(scope).getScope().equals( && depth == e.depth;
ArtifactScopeEnum.checkScope(e.scope).getScope()
)
&& depth == e.depth
;
} }
return false; return false;
} }
@ -143,6 +149,7 @@ public String getArtifactUri()
{ {
return artifactUri; return artifactUri;
} }
public void setArtifactUri( String artifactUri ) public void setArtifactUri( String artifactUri )
{ {
this.artifactUri = artifactUri; this.artifactUri = artifactUri;
@ -152,28 +159,30 @@ public MetadataGraphVertex getSource()
{ {
return source; return source;
} }
public void setSource( MetadataGraphVertex source ) public void setSource( MetadataGraphVertex source )
{ {
this.source = source; this.source = source;
} }
public MetadataGraphVertex getTarget() public MetadataGraphVertex getTarget()
{ {
return target; return target;
} }
public void setTarget( MetadataGraphVertex target ) public void setTarget( MetadataGraphVertex target )
{ {
this.target = target; this.target = target;
} }
@Override @Override
public String toString() public String toString()
{ {
return "[ " return "[ " + "FROM:("
+ "FROM:("+( source==null?"no source":(source.md==null?"no source MD":source.md.toString()) )+") " + ( source == null ? "no source" : ( source.md == null ? "no source MD" : source.md.toString() ) ) + ") "
+ "TO:("+( target==null?"no target":(target.md==null?"no target MD":target.md.toString()) )+") " + "TO:(" + ( target == null ? "no target" : ( target.md == null ? "no target MD" : target.md.toString() ) )
+"version="+version + ") " + "version=" + version + ", scope=" + ( scope == null ? "null" : scope.getScope() ) + ", depth="
+", scope="+(scope == null ? "null" : scope.getScope()) + depth + "]";
+", depth="+depth+"]"
;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -1,5 +1,24 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/** /**
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a> * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
* *

View File

@ -1,5 +1,24 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Collection; import java.util.Collection;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
@ -22,8 +41,7 @@ public MetadataResolution( ArtifactMetadata artifactMetadata )
this.artifactMetadata = artifactMetadata; this.artifactMetadata = artifactMetadata;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
public MetadataResolution( ArtifactMetadata artifactMetadata, public MetadataResolution( ArtifactMetadata artifactMetadata, Collection<ArtifactRepository> metadataRepositories )
Collection<ArtifactRepository> metadataRepositories )
{ {
this( artifactMetadata ); this( artifactMetadata );
this.metadataRepositories = metadataRepositories; this.metadataRepositories = metadataRepositories;
@ -34,8 +52,7 @@ public Collection<ArtifactRepository> getMetadataRepositories()
return metadataRepositories; return metadataRepositories;
} }
public void setMetadataRepositories( public void setMetadataRepositories( Collection<ArtifactRepository> metadataRepositories )
Collection<ArtifactRepository> metadataRepositories)
{ {
this.metadataRepositories = metadataRepositories; this.metadataRepositories = metadataRepositories;
} }

View File

@ -1,5 +1,24 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
public class MetadataResolutionException public class MetadataResolutionException
extends Exception extends Exception
{ {
@ -21,8 +40,7 @@ public MetadataResolutionException( Throwable cause )
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public MetadataResolutionException( String message, public MetadataResolutionException( String message, Throwable cause )
Throwable cause )
{ {
super( message, cause ); super( message, cause );
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub

View File

@ -1,10 +1,28 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.List; import java.util.List;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
/** @author Oleg Gusakov */ /** @author Oleg Gusakov */
public class MetadataResolutionRequest public class MetadataResolutionRequest
{ {
@ -18,8 +36,7 @@ public MetadataResolutionRequest()
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public MetadataResolutionRequest( ArtifactMetadata query, public MetadataResolutionRequest( ArtifactMetadata query, ArtifactRepository localRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories ) List<ArtifactRepository> remoteRepositories )
{ {
this.query = query; this.query = query;

View File

@ -1,5 +1,24 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
public enum MetadataResolutionRequestTypeEnum public enum MetadataResolutionRequestTypeEnum
{ {
tree( 1 ) tree( 1 )

View File

@ -41,15 +41,12 @@ public MetadataRetrievalException( Throwable cause )
this( null, cause, null ); this( null, cause, null );
} }
public MetadataRetrievalException( String message, public MetadataRetrievalException( String message, Throwable cause )
Throwable cause )
{ {
this( message, cause, null ); this( message, cause, null );
} }
public MetadataRetrievalException( String message, public MetadataRetrievalException( String message, Throwable cause, ArtifactMetadata artifact )
Throwable cause,
ArtifactMetadata artifact )
{ {
super( message, cause ); super( message, cause );

View File

@ -34,6 +34,7 @@ public interface MetadataSource
{ {
String ROLE = MetadataSource.class.getName(); String ROLE = MetadataSource.class.getName();
MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
throws MetadataRetrievalException; throws MetadataRetrievalException;
} }

View File

@ -1,14 +1,33 @@
package org.apache.maven.repository.metadata; package org.apache.maven.repository.metadata;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactScopeEnum; import org.apache.maven.artifact.ArtifactScopeEnum;
/** /**
* metadata [dirty] Tree * metadata [dirty] Tree
* *
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a> * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>
* *
*/ */
public class MetadataTreeNode public class MetadataTreeNode
{ {
ArtifactMetadata md; // this node ArtifactMetadata md; // this node
@ -35,10 +54,7 @@ public MetadataTreeNode()
{ {
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
public MetadataTreeNode( ArtifactMetadata md, public MetadataTreeNode( ArtifactMetadata md, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope )
MetadataTreeNode parent,
boolean resolved,
ArtifactScopeEnum scope )
{ {
if ( md != null ) if ( md != null )
{ {
@ -50,14 +66,11 @@ public MetadataTreeNode( ArtifactMetadata md,
this.parent = parent; this.parent = parent;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
public MetadataTreeNode( Artifact af, public MetadataTreeNode( Artifact af, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope )
MetadataTreeNode parent,
boolean resolved,
ArtifactScopeEnum scope
)
{ {
this( new ArtifactMetadata( af ), parent, resolved, scope ); this( new ArtifactMetadata( af ), parent, resolved, scope );
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
public void addChild( int index, MetadataTreeNode kid ) public void addChild( int index, MetadataTreeNode kid )
{ {
@ -67,16 +80,20 @@ public void addChild( int index, MetadataTreeNode kid )
} }
if ( children == null ) if ( children == null )
{
children = new MetadataTreeNode[nChildren]; children = new MetadataTreeNode[nChildren];
}
children[index % nChildren] = kid; children[index % nChildren] = kid;
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
@Override @Override
public String toString() public String toString()
{ {
return md == null ? "no metadata" : md.toString(); return md == null ? "no metadata" : md.toString();
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public String graphHash() public String graphHash()
throws MetadataResolutionException throws MetadataResolutionException
@ -84,8 +101,7 @@ public String graphHash()
if ( md == null ) if ( md == null )
{ {
throw new MetadataResolutionException( "treenode without metadata, parent: " throw new MetadataResolutionException( "treenode without metadata, parent: "
+ ( parent == null ? "null" : parent.toString() ) + ( parent == null ? "null" : parent.toString() ) );
);
} }
return md.groupId + ":" + md.artifactId; return md.groupId + ":" + md.artifactId;

View File

@ -72,11 +72,13 @@ public static Map load()
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new ExpressionDocumentationException( "Failed to read documentation for expression root: " + EXPRESSION_ROOTS[i], e ); throw new ExpressionDocumentationException( "Failed to read documentation for expression root: "
+ EXPRESSION_ROOTS[i], e );
} }
catch ( XmlPullParserException e ) catch ( XmlPullParserException e )
{ {
throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + EXPRESSION_ROOTS[i], e ); throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: "
+ EXPRESSION_ROOTS[i], e );
} }
finally finally
{ {

View File

@ -1,21 +1,24 @@
package org.apache.maven; package org.apache.maven;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
/** /**
@ -34,7 +37,8 @@ public abstract class AbstractMavenLifecycleParticipant
* This callback is intended to allow extensions to manipulate MavenProjects * This callback is intended to allow extensions to manipulate MavenProjects
* before they are sorted and actual build execution starts. * before they are sorted and actual build execution starts.
*/ */
public void afterProjectsRead( MavenSession session ) throws MavenExecutionException public void afterProjectsRead( MavenSession session )
throws MavenExecutionException
{ {
// do nothing // do nothing
} }
@ -47,7 +51,8 @@ public void afterProjectsRead( MavenSession session ) throws MavenExecutionExcep
* instance construction. * instance construction.
*/ */
// TODO: This is too early for build extensions, so maybe just remove it? // TODO: This is too early for build extensions, so maybe just remove it?
public void afterSessionStart( MavenSession session ) throws MavenExecutionException public void afterSessionStart( MavenSession session )
throws MavenExecutionException
{ {
// do nothing // do nothing
} }

View File

@ -1,5 +1,24 @@
package org.apache.maven; package org.apache.maven;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Set; import java.util.Set;
public interface ArtifactFilterManagerDelegate public interface ArtifactFilterManagerDelegate

View File

@ -1,6 +1,5 @@
package org.apache.maven; package org.apache.maven;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file

View File

@ -1,18 +1,22 @@
package org.apache.maven; package org.apache.maven;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -37,7 +41,6 @@
import org.apache.maven.execution.MavenExecutionResult; import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.lifecycle.internal.ExecutionEventCatapult; import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
import org.apache.maven.lifecycle.internal.LifecycleStarter; import org.apache.maven.lifecycle.internal.LifecycleStarter;
import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblem;
@ -120,7 +123,8 @@ private MavenExecutionResult doExecute( MavenExecutionRequest request )
//TODO: Need a general way to inject standard properties //TODO: Need a general way to inject standard properties
if ( request.getStartTime() != null ) if ( request.getStartTime() != null )
{ {
request.getSystemProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) ); request.getSystemProperties().put( "${build.timestamp}",
new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
} }
request.setStartTime( new Date() ); request.setStartTime( new Date() );
@ -401,7 +405,8 @@ private void collectProjects( List<MavenProject> projects, List<File> files, Mav
{ {
ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest(); ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest();
List<ProjectBuildingResult> results = projectBuilder.build( files, request.isRecursive(), projectBuildingRequest ); List<ProjectBuildingResult> results =
projectBuilder.build( files, request.isRecursive(), projectBuildingRequest );
boolean problems = false; boolean problems = false;
@ -418,7 +423,8 @@ private void collectProjects( List<MavenProject> projects, List<File> files, Mav
for ( ModelProblem problem : result.getProblems() ) for ( ModelProblem problem : result.getProblems() )
{ {
String location = ModelProblemUtils.formatLocation( problem, result.getProjectId() ); String location = ModelProblemUtils.formatLocation( problem, result.getProjectId() );
logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) ); logger.warn( problem.getMessage()
+ ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) );
} }
problems = true; problems = true;

View File

@ -97,15 +97,15 @@ private Set<Artifact> resolveImpl( Collection<? extends MavenProject> projects,
return resolved; return resolved;
} }
if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) && if ( ( scopesToCollect == null || scopesToCollect.isEmpty() )
( scopesToResolve == null || scopesToResolve.isEmpty() ) ) && ( scopesToResolve == null || scopesToResolve.isEmpty() ) )
{ {
return resolved; return resolved;
} }
/* /*
Logic for transitve global exclusions Logic for transitive global exclusions
List<String> exclusions = new ArrayList<String>(); List<String> exclusions = new ArrayList<String>();
@ -126,7 +126,8 @@ private Set<Artifact> resolveImpl( Collection<? extends MavenProject> projects,
if ( ! exclusions.isEmpty() ) if ( ! exclusions.isEmpty() )
{ {
filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ new ExcludesArtifactFilter( exclusions ), scopeFilter } ) ); filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ new ExcludesArtifactFilter( exclusions ),
scopeFilter } ) );
} }
else else
{ {
@ -140,10 +141,10 @@ private Set<Artifact> resolveImpl( Collection<? extends MavenProject> projects,
collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter ); collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter );
ArtifactResolutionRequest request = ArtifactResolutionRequest request =
new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true ).setCollectionFilter( new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true )
collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter ).setLocalRepository( .setCollectionFilter( collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter )
session.getLocalRepository() ).setOffline( session.isOffline() ).setForceUpdate( .setLocalRepository( session.getLocalRepository() ).setOffline( session.isOffline() )
session.getRequest().isUpdateSnapshots() ).setCache( session.getRepositoryCache() ); .setForceUpdate( session.getRequest().isUpdateSnapshots() ).setCache( session.getRepositoryCache() );
request.setTransferListener( session.getRequest().getTransferListener() ); request.setTransferListener( session.getRequest().getTransferListener() );
request.setServers( session.getRequest().getServers() ); request.setServers( session.getRequest().getServers() );
request.setMirrors( session.getRequest().getMirrors() ); request.setMirrors( session.getRequest().getMirrors() );

View File

@ -1,5 +1,23 @@
package org.apache.maven; package org.apache.maven;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.File; import java.io.File;

View File

@ -1,5 +1,24 @@
package org.apache.maven; package org.apache.maven;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.codehaus.plexus.util.dag.CycleDetectedException; import org.codehaus.plexus.util.dag.CycleDetectedException;
/** /**

View File

@ -39,7 +39,7 @@ public interface ProjectDependenciesResolver
* @param session The current build session, must not be {@code null}. * @param session The current build session, must not be {@code null}.
* @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
*/ */
public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session ) Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
/** /**
@ -51,7 +51,7 @@ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToR
* @param session The current build session, must not be {@code null}. * @param session The current build session, must not be {@code null}.
* @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
*/ */
public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect, Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
Collection<String> scopesToResolve, MavenSession session ) Collection<String> scopesToResolve, MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@ -65,9 +65,8 @@ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToC
* @param ignoreableArtifacts Artifacts that need not be resolved * @param ignoreableArtifacts Artifacts that need not be resolved
* @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
*/ */
public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect, Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
Collection<String> scopesToResolve, MavenSession session, Collection<String> scopesToResolve, MavenSession session, Set<Artifact> ignoreableArtifacts )
Set<Artifact> ignoreableArtifacts )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
@ -83,8 +82,7 @@ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToC
* @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null} * @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null}
* . * .
*/ */
public Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, MavenSession session )
MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
} }

View File

@ -25,7 +25,12 @@
import org.apache.maven.repository.LocalArtifactRepository; import org.apache.maven.repository.LocalArtifactRepository;
import java.io.File; import java.io.File;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* An implementation of a repository that knows how to search the Maven reactor for artifacts. * An implementation of a repository that knows how to search the Maven reactor for artifacts.

View File

@ -1,9 +1,5 @@
package org.apache.maven.artifact; package org.apache.maven.artifact;
import java.net.MalformedURLException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -23,6 +19,10 @@
* under the License. * under the License.
*/ */
import java.net.MalformedURLException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/** /**
* Error constructing an artifact repository. * Error constructing an artifact repository.
* *
@ -34,17 +34,13 @@ public class InvalidRepositoryException
{ {
private final String repositoryId; private final String repositoryId;
public InvalidRepositoryException( String message, public InvalidRepositoryException( String message, String repositoryId, MalformedURLException cause )
String repositoryId,
MalformedURLException cause )
{ {
super( message, cause ); super( message, cause );
this.repositoryId = repositoryId; this.repositoryId = repositoryId;
} }
protected InvalidRepositoryException( String message, protected InvalidRepositoryException( String message, String repositoryId, ComponentLookupException cause )
String repositoryId,
ComponentLookupException cause )
{ {
super( message, cause ); super( message, cause );
this.repositoryId = repositoryId; this.repositoryId = repositoryId;
@ -57,8 +53,7 @@ public InvalidRepositoryException( String message, Throwable t )
this.repositoryId = null; this.repositoryId = null;
} }
public InvalidRepositoryException( String message, public InvalidRepositoryException( String message, String repositoryId )
String repositoryId )
{ {
super( message ); super( message );
this.repositoryId = repositoryId; this.repositoryId = repositoryId;

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.factory; package org.apache.maven.artifact.factory;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
@ -26,15 +30,20 @@ public interface ArtifactFactory
Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type ); Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ); Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
String classifier );
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope ); Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope );
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, boolean optional ); Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, boolean optional );
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ); Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, String inheritedScope );
Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ); Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, String inheritedScope, boolean optional );
Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging ); Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging );

View File

@ -39,27 +39,33 @@ public Artifact createArtifact( String groupId, String artifactId, String versio
return createArtifact( groupId, artifactId, version, scope, type, null, null ); return createArtifact( groupId, artifactId, version, scope, type, null, null );
} }
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
String classifier )
{ {
return createArtifact( groupId, artifactId, version, null, type, classifier, null ); return createArtifact( groupId, artifactId, version, null, type, classifier, null );
} }
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope ) public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
String type, String classifier, String scope )
{ {
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null );
} }
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, boolean optional ) public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
String type, String classifier, String scope, boolean optional )
{ {
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional );
} }
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ) public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
String type, String classifier, String scope, String inheritedScope )
{ {
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
} }
public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ) public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
String type, String classifier, String scope, String inheritedScope,
boolean optional )
{ {
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, optional ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, optional );
} }
@ -94,7 +100,8 @@ public Artifact createExtensionArtifact( String groupId, String artifactId, Vers
return createArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null ); return createArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null );
} }
private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type, String classifier, String inheritedScope ) private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
String classifier, String inheritedScope )
{ {
VersionRange versionRange = null; VersionRange versionRange = null;
if ( version != null ) if ( version != null )
@ -104,12 +111,14 @@ private Artifact createArtifact( String groupId, String artifactId, String versi
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
} }
private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ) private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, String inheritedScope )
{ {
return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false ); return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false );
} }
private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ) private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
String classifier, String scope, String inheritedScope, boolean optional )
{ {
String desiredScope = Artifact.SCOPE_RUNTIME; String desiredScope = Artifact.SCOPE_RUNTIME;
@ -145,6 +154,7 @@ else if ( Artifact.SCOPE_COMPILE.equals( scope ) && Artifact.SCOPE_COMPILE.equal
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type ); ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler, optional ); return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
optional );
} }
} }

View File

@ -1,7 +1,5 @@
package org.apache.maven.artifact.handler; package org.apache.maven.artifact.handler;
import org.codehaus.plexus.component.annotations.Component;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
@ -21,6 +19,8 @@
* under the License. * under the License.
*/ */
import org.codehaus.plexus.component.annotations.Component;
/** /**
* @author <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author Jason van Zyl * @author Jason van Zyl

View File

@ -34,15 +34,19 @@ public interface ArtifactMetadataSource
ResolutionGroup retrieve( MetadataResolutionRequest request ) ResolutionGroup retrieve( MetadataResolutionRequest request )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request ) List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
ArtifactRepository localRepository,
ArtifactRepository remoteRepository )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
} }

View File

@ -1,18 +1,22 @@
package org.apache.maven.artifact.metadata; package org.apache.maven.artifact.metadata;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license * Licensed to the Apache Software Foundation (ASF) under one
* agreements. See the NOTICE file distributed with this work for additional information regarding * or more contributor license agreements. See the NOTICE file
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the * distributed with this work for additional information
* "License"); you may not use this file except in compliance with the License. You may obtain a * regarding copyright ownership. The ASF licenses this file
* copy of the License at * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software distributed under the License * Unless required by applicable law or agreed to in writing,
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * software distributed under the License is distributed on an
* or implied. See the License for the specific language governing permissions and limitations under * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* the License. * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import java.util.List; import java.util.List;

View File

@ -70,12 +70,14 @@ public DefaultRepositoryRequest( RepositoryRequest repositoryRequest )
setTransferListener( repositoryRequest.getTransferListener() ); setTransferListener( repositoryRequest.getTransferListener() );
} }
public static RepositoryRequest getRepositoryRequest(MavenSession session, MavenProject project) { public static RepositoryRequest getRepositoryRequest( MavenSession session, MavenProject project )
{
RepositoryRequest request = new DefaultRepositoryRequest(); RepositoryRequest request = new DefaultRepositoryRequest();
request.setCache( session.getRepositoryCache() ); request.setCache( session.getRepositoryCache() );
request.setLocalRepository( session.getLocalRepository() ); request.setLocalRepository( session.getLocalRepository() );
if (project != null) { if ( project != null )
{
request.setRemoteRepositories( project.getPluginArtifactRepositories() ); request.setRemoteRepositories( project.getPluginArtifactRepositories() );
} }
request.setOffline( session.isOffline() ); request.setOffline( session.isOffline() );

View File

@ -63,7 +63,8 @@ public MavenArtifactRepository()
* @param snapshots the policies to use for snapshots * @param snapshots the policies to use for snapshots
* @param releases the policies to use for releases * @param releases the policies to use for releases
*/ */
public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
{ {
this.id = id; this.id = id;
this.url = url; this.url = url;

View File

@ -31,10 +31,12 @@ public interface RepositoryMetadataManager
void resolve( RepositoryMetadata repositoryMetadata, RepositoryRequest repositoryRequest ) void resolve( RepositoryMetadata repositoryMetadata, RepositoryRequest repositoryRequest )
throws RepositoryMetadataResolutionException; throws RepositoryMetadataResolutionException;
void resolve( RepositoryMetadata repositoryMetadata, List<ArtifactRepository> repositories, ArtifactRepository localRepository ) void resolve( RepositoryMetadata repositoryMetadata, List<ArtifactRepository> repositories,
ArtifactRepository localRepository )
throws RepositoryMetadataResolutionException; throws RepositoryMetadataResolutionException;
void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository,
ArtifactRepository remoteRepository )
throws RepositoryMetadataResolutionException; throws RepositoryMetadataResolutionException;
/** /**
@ -44,7 +46,8 @@ void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localReposit
* @param localRepository the local repository to install to first * @param localRepository the local repository to install to first
* @param deploymentRepository the remote repository to deploy to * @param deploymentRepository the remote repository to deploy to
*/ */
void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository ) void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository,
ArtifactRepository deploymentRepository )
throws RepositoryMetadataDeploymentException; throws RepositoryMetadataDeploymentException;
/** /**

View File

@ -39,7 +39,7 @@ public interface MetadataReader
* The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code * The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
* true}. If {@code false}, unknown elements will be ignored instead of causing a failure. * true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
*/ */
static final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict"; final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict";
/** /**
* Reads the metadata from the specified file. * Reads the metadata from the specified file.

Some files were not shown because too many files have changed in this diff Show More