mirror of https://github.com/apache/maven.git
Kept John's constructors but still use File/URL instead of String
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@587691 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c1b32bfc0
commit
f3398365f1
|
@ -78,6 +78,8 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -209,7 +211,8 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
|
Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
|
||||||
|
|
||||||
return buildInternal( "Artifact [" + artifact + "]", model, localRepository, remoteArtifactRepositories, null, null, false, false );
|
return buildInternal( artifact.getFile(), model, localRepository, remoteArtifactRepositories, null, null,
|
||||||
|
false, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenProject superProject;
|
private MavenProject superProject;
|
||||||
|
@ -289,7 +292,7 @@ public class DefaultMavenProjectBuilder
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId,
|
throw new ProjectBuildingException( projectId,
|
||||||
"Unable to build project due to an invalid dependency version: " +
|
"Unable to build project due to an invalid dependency version: " +
|
||||||
e.getMessage(), projectDescriptor.getAbsolutePath(), e );
|
e.getMessage(), projectDescriptor, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
|
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
|
||||||
|
@ -371,7 +374,7 @@ public class DefaultMavenProjectBuilder
|
||||||
catch ( InvalidVersionSpecificationException e )
|
catch ( InvalidVersionSpecificationException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId, "Unable to parse version '" + d.getVersion() +
|
throw new ProjectBuildingException( projectId, "Unable to parse version '" + d.getVersion() +
|
||||||
"' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), pomFile.getAbsolutePath(), e );
|
"' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), pomFile, e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +400,7 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
Model model = readModel( "unknown", projectDescriptor, STRICT_MODEL_PARSING );
|
Model model = readModel( "unknown", projectDescriptor, STRICT_MODEL_PARSING );
|
||||||
|
|
||||||
MavenProject project = buildInternal( projectDescriptor.getAbsolutePath(),
|
MavenProject project = buildInternal( projectDescriptor,
|
||||||
model,
|
model,
|
||||||
localRepository,
|
localRepository,
|
||||||
buildArtifactRepositories( getSuperModel() ),
|
buildArtifactRepositories( getSuperModel() ),
|
||||||
|
@ -526,7 +529,7 @@ public class DefaultMavenProjectBuilder
|
||||||
// jvz:note
|
// jvz:note
|
||||||
// We've got a mixture of things going in the USD and from the repository, sometimes the descriptor
|
// We've got a mixture of things going in the USD and from the repository, sometimes the descriptor
|
||||||
// is a real file and sometimes null which makes things confusing.
|
// is a real file and sometimes null which makes things confusing.
|
||||||
private MavenProject buildInternal( String pomLocation,
|
private MavenProject buildInternal( File pomLocation,
|
||||||
Model model,
|
Model model,
|
||||||
ArtifactRepository localRepository,
|
ArtifactRepository localRepository,
|
||||||
List parentSearchRepositories,
|
List parentSearchRepositories,
|
||||||
|
@ -554,7 +557,7 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
catch ( ProfileActivationException e )
|
catch ( ProfileActivationException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor.getAbsolutePath(), e );
|
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
explicitlyActive = externalProfileManager.getExplicitlyActivatedIds();
|
explicitlyActive = externalProfileManager.getExplicitlyActivatedIds();
|
||||||
|
@ -645,11 +648,11 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
catch ( ModelInterpolationException e )
|
catch ( ModelInterpolationException e )
|
||||||
{
|
{
|
||||||
throw new InvalidProjectModelException( projectId, pomLocation, e.getMessage(), e );
|
throw new InvalidProjectModelException( projectId, e.getMessage(), pomLocation, e );
|
||||||
}
|
}
|
||||||
catch ( InvalidRepositoryException e )
|
catch ( InvalidRepositoryException e )
|
||||||
{
|
{
|
||||||
throw new InvalidProjectModelException( projectId, pomLocation, e.getMessage(), e );
|
throw new InvalidProjectModelException( projectId, e.getMessage(), pomLocation, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
|
ProjectBuildCache projectBuildCache = ProjectBuildCache.read( buildContextManager );
|
||||||
|
@ -798,7 +801,7 @@ public class DefaultMavenProjectBuilder
|
||||||
* the resolved source roots, etc for the parent - that occurs for the parent when it is constructed independently
|
* the resolved source roots, etc for the parent - that occurs for the parent when it is constructed independently
|
||||||
* and projects are not cached or reused
|
* and projects are not cached or reused
|
||||||
*/
|
*/
|
||||||
private MavenProject processProjectLogic( String pomLocation,
|
private MavenProject processProjectLogic( File pomLocation,
|
||||||
MavenProject project,
|
MavenProject project,
|
||||||
File pomFile,
|
File pomFile,
|
||||||
boolean strict )
|
boolean strict )
|
||||||
|
@ -882,7 +885,7 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
if ( validationResult.getMessageCount() > 0 )
|
if ( validationResult.getMessageCount() > 0 )
|
||||||
{
|
{
|
||||||
throw new InvalidProjectModelException( projectId, pomLocation, "Failed to validate POM",
|
throw new InvalidProjectModelException( projectId, "Failed to validate POM", pomLocation,
|
||||||
validationResult );
|
validationResult );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,17 +1001,17 @@ public class DefaultMavenProjectBuilder
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reader = ReaderFactory.newXmlReader( file );
|
reader = ReaderFactory.newXmlReader( file );
|
||||||
return readModel( projectId, file.getAbsolutePath(), reader, strict );
|
return readModel( projectId, file.toURI(), reader, strict );
|
||||||
}
|
}
|
||||||
catch ( FileNotFoundException e )
|
catch ( FileNotFoundException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId,
|
throw new ProjectBuildingException( projectId,
|
||||||
"Could not find the model file '" + file.getAbsolutePath() + "'.", file.getAbsolutePath(), e );
|
"Could not find the model file '" + file.getAbsolutePath() + "'.", file, e );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId, "Failed to build model from file '" +
|
throw new ProjectBuildingException( projectId, "Failed to build model from file '" +
|
||||||
file.getAbsolutePath() + "'.\nError: \'" + e.getLocalizedMessage() + "\'", file.getAbsolutePath(), e );
|
file.getAbsolutePath() + "'.\nError: \'" + e.getLocalizedMessage() + "\'", file, e );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1017,7 +1020,7 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model readModel( String projectId,
|
private Model readModel( String projectId,
|
||||||
String pomLocation,
|
URI pomLocation,
|
||||||
Reader reader,
|
Reader reader,
|
||||||
boolean strict )
|
boolean strict )
|
||||||
throws IOException, InvalidProjectModelException
|
throws IOException, InvalidProjectModelException
|
||||||
|
@ -1026,7 +1029,7 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
if ( modelSource.indexOf( "<modelVersion>" + MAVEN_MODEL_VERSION ) < 0 )
|
if ( modelSource.indexOf( "<modelVersion>" + MAVEN_MODEL_VERSION ) < 0 )
|
||||||
{
|
{
|
||||||
throw new InvalidProjectModelException( projectId, pomLocation, "Not a v" + MAVEN_MODEL_VERSION + " POM." );
|
throw new InvalidProjectModelException( projectId, "Not a v" + MAVEN_MODEL_VERSION + " POM.", pomLocation );
|
||||||
}
|
}
|
||||||
|
|
||||||
StringReader sReader = new StringReader( modelSource );
|
StringReader sReader = new StringReader( modelSource );
|
||||||
|
@ -1037,8 +1040,8 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
catch ( XmlPullParserException e )
|
catch ( XmlPullParserException e )
|
||||||
{
|
{
|
||||||
throw new InvalidProjectModelException( projectId, pomLocation,
|
throw new InvalidProjectModelException( projectId, "Parse error reading POM. Reason: " + e.getMessage(),
|
||||||
"Parse error reading POM. Reason: " + e.getMessage(), e );
|
pomLocation, e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,15 +1051,22 @@ public class DefaultMavenProjectBuilder
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Reader reader = null;
|
Reader reader = null;
|
||||||
|
URI uri = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
uri = url.toURI();
|
||||||
reader = ReaderFactory.newXmlReader( url.openStream() );
|
reader = ReaderFactory.newXmlReader( url.openStream() );
|
||||||
return readModel( projectId, url.toExternalForm(), reader, strict );
|
return readModel( projectId, uri, reader, strict );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm() +
|
throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm() +
|
||||||
"\'\nError: \'" + e.getLocalizedMessage() + "\'", url.toExternalForm(), e );
|
"\'\nError: \'" + e.getLocalizedMessage() + "\'", uri, e );
|
||||||
|
}
|
||||||
|
catch ( URISyntaxException e )
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm()
|
||||||
|
+ "\'\nError: \'" + e.getLocalizedMessage() + "\'", e );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1064,9 +1074,32 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link #createPluginArtifacts(String, List, File)}
|
||||||
|
* @param projectId
|
||||||
|
* @param plugins
|
||||||
|
* @param pomLocation absolute path of pom file
|
||||||
|
* @return
|
||||||
|
* @throws ProjectBuildingException
|
||||||
|
*/
|
||||||
protected Set createPluginArtifacts( String projectId,
|
protected Set createPluginArtifacts( String projectId,
|
||||||
List plugins, String pomLocation )
|
List plugins, String pomLocation )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
return createPluginArtifacts( projectId, plugins, new File( pomLocation ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param projectId
|
||||||
|
* @param plugins
|
||||||
|
* @param pomLocation pom file
|
||||||
|
* @return
|
||||||
|
* @throws ProjectBuildingException
|
||||||
|
*/
|
||||||
|
protected Set createPluginArtifacts( String projectId,
|
||||||
|
List plugins, File pomLocation )
|
||||||
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Set pluginArtifacts = new HashSet();
|
Set pluginArtifacts = new HashSet();
|
||||||
|
|
||||||
|
@ -1106,10 +1139,25 @@ public class DefaultMavenProjectBuilder
|
||||||
return pluginArtifacts;
|
return pluginArtifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: share with createPluginArtifacts?
|
/**
|
||||||
|
* @deprecated use {@link #createReportArtifacts(String, List, File)}
|
||||||
|
* @param projectId
|
||||||
|
* @param reports
|
||||||
|
* @param pomLocation absolute path of pom file
|
||||||
|
* @return
|
||||||
|
* @throws ProjectBuildingException
|
||||||
|
*/
|
||||||
protected Set createReportArtifacts( String projectId,
|
protected Set createReportArtifacts( String projectId,
|
||||||
List reports, String pomLocation )
|
List reports, String pomLocation )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
return createReportArtifacts( projectId, reports, new File( pomLocation ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: share with createPluginArtifacts?
|
||||||
|
protected Set createReportArtifacts( String projectId,
|
||||||
|
List reports, File pomLocation )
|
||||||
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Set pluginArtifacts = new HashSet();
|
Set pluginArtifacts = new HashSet();
|
||||||
|
|
||||||
|
@ -1152,10 +1200,25 @@ public class DefaultMavenProjectBuilder
|
||||||
return pluginArtifacts;
|
return pluginArtifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: share with createPluginArtifacts?
|
/**
|
||||||
|
* @deprecated use {@link #createExtensionArtifacts(String, List, File)}
|
||||||
|
* @param projectId
|
||||||
|
* @param extensions
|
||||||
|
* @param pomLocation absolute path of pom file
|
||||||
|
* @return
|
||||||
|
* @throws ProjectBuildingException
|
||||||
|
*/
|
||||||
protected Set createExtensionArtifacts( String projectId,
|
protected Set createExtensionArtifacts( String projectId,
|
||||||
List extensions, String pomLocation )
|
List extensions, String pomLocation )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
|
{
|
||||||
|
return createExtensionArtifacts( projectId, extensions, new File( pomLocation ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: share with createPluginArtifacts?
|
||||||
|
protected Set createExtensionArtifacts( String projectId,
|
||||||
|
List extensions, File pomLocation )
|
||||||
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Set extensionArtifacts = new HashSet();
|
Set extensionArtifacts = new HashSet();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.maven.project;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||||
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
||||||
import org.apache.maven.project.validation.ModelValidationResult;
|
import org.apache.maven.project.validation.ModelValidationResult;
|
||||||
|
@ -29,43 +32,94 @@ public class InvalidProjectModelException
|
||||||
{
|
{
|
||||||
private ModelValidationResult validationResult;
|
private ModelValidationResult validationResult;
|
||||||
|
|
||||||
public InvalidProjectModelException( String projectId,
|
/**
|
||||||
String pomLocation,
|
*
|
||||||
String message,
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomLocation pom location
|
||||||
|
*/
|
||||||
|
public InvalidProjectModelException( String projectId, String message, URI pomLocation )
|
||||||
|
{
|
||||||
|
super( projectId, message, pomLocation );
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProjectModelException( String projectId, String message, File pomLocation )
|
||||||
|
{
|
||||||
|
super( projectId, message, pomLocation );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
* @param projectId
|
||||||
|
* @param pomLocation absolute path of the pom file
|
||||||
|
* @param message
|
||||||
|
* @param validationResult
|
||||||
|
*/
|
||||||
|
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||||
|
ModelValidationResult validationResult )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ), validationResult );
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProjectModelException( String projectId, String message, File pomFile,
|
||||||
|
ModelValidationResult validationResult )
|
||||||
|
{
|
||||||
|
super( projectId, message, pomFile );
|
||||||
|
|
||||||
|
this.validationResult = validationResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
* @param projectId
|
||||||
|
* @param pomLocation absolute path of the pom file
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public InvalidProjectModelException( String projectId, String pomLocation, String message )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
*/
|
||||||
|
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||||
|
ModelInterpolationException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProjectModelException( String projectId, String message, File pomLocation,
|
||||||
ModelInterpolationException cause )
|
ModelInterpolationException cause )
|
||||||
{
|
{
|
||||||
super( projectId, message, pomLocation, cause );
|
super( projectId, message, pomLocation, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
public InvalidProjectModelException( String projectId,
|
/**
|
||||||
String pomLocation,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String message,
|
*/
|
||||||
|
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||||
|
InvalidRepositoryException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProjectModelException( String projectId, String message, File pomLocation,
|
||||||
InvalidRepositoryException cause )
|
InvalidRepositoryException cause )
|
||||||
{
|
{
|
||||||
super( projectId, message, pomLocation, cause );
|
super( projectId, message, pomLocation, cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
public InvalidProjectModelException( String projectId,
|
/**
|
||||||
String pomLocation,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String message,
|
*/
|
||||||
ModelValidationResult validationResult )
|
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||||
{
|
|
||||||
super( projectId, message, pomLocation );
|
|
||||||
|
|
||||||
this.validationResult = validationResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public InvalidProjectModelException( String projectId,
|
|
||||||
String pomLocation,
|
|
||||||
String message )
|
|
||||||
{
|
|
||||||
super( projectId, message, pomLocation );
|
|
||||||
}
|
|
||||||
|
|
||||||
public InvalidProjectModelException( String projectId,
|
|
||||||
String pomLocation,
|
|
||||||
String message,
|
|
||||||
XmlPullParserException cause )
|
XmlPullParserException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ).toURI(), cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProjectModelException( String projectId, String message, URI pomLocation, XmlPullParserException cause )
|
||||||
{
|
{
|
||||||
super( projectId, message, pomLocation, cause );
|
super( projectId, message, pomLocation, cause );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package org.apache.maven.project;
|
package org.apache.maven.project;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
|
@ -9,8 +14,6 @@ import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||||
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
@ -39,149 +42,247 @@ public class ProjectBuildingException
|
||||||
{
|
{
|
||||||
private final String projectId;
|
private final String projectId;
|
||||||
|
|
||||||
private String pomLocation;
|
private URI pomUri;
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message )
|
||||||
String message )
|
|
||||||
{
|
{
|
||||||
super( message );
|
this( projectId, message, (URI) null );
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation )
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomLocation absolute path of the pom file
|
||||||
|
*/
|
||||||
|
protected ProjectBuildingException( String projectId, String message, String pomLocation )
|
||||||
{
|
{
|
||||||
super( message );
|
this( projectId, message, pomLocation, (Throwable) null );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation,
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomLocation absolute path of the pom file
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
private ProjectBuildingException( String projectId, String message, String pomLocation, Throwable cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomFile pom file location
|
||||||
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, File pomFile )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomFile, (Throwable) null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
private ProjectBuildingException( String projectId, String message, Throwable cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, (URI) null, cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, URISyntaxException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomFile pom file location
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, File pomFile, Throwable cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomFile.toURI(), cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Equivalent to new ProjectBuildingException(projectId, message, pomUri, null)
|
||||||
|
*
|
||||||
|
* @see #ProjectBuildingException(String, String, URI, Throwable)
|
||||||
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, URI pomUri )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomUri, (Throwable) null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
ProfileActivationException cause )
|
ProfileActivationException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message, File pomLocation,
|
||||||
String message,
|
ProfileActivationException cause )
|
||||||
String pomLocation,
|
{
|
||||||
IOException cause )
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param projectId
|
||||||
|
* @param message
|
||||||
|
* @param pomUri location of the pom
|
||||||
|
* @param cause
|
||||||
|
*/
|
||||||
|
private ProjectBuildingException( String projectId, String message, URI pomUri, Throwable cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
super( message, cause );
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
this.pomLocation = pomLocation;
|
this.pomUri = pomUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation,
|
*/
|
||||||
XmlPullParserException cause )
|
public ProjectBuildingException( String projectId, String message, String pomLocation, IOException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message, URI pomLocation, IOException cause )
|
||||||
String message,
|
|
||||||
XmlPullParserException cause )
|
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation,
|
*/
|
||||||
InvalidRepositoryException cause )
|
public ProjectBuildingException( String projectId, String message, String pomLocation, XmlPullParserException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, new File( pomLocation ), cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message, URI pomLocation, XmlPullParserException cause )
|
||||||
String message,
|
|
||||||
InvalidRepositoryException cause )
|
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( message, projectId, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
protected ProjectBuildingException( String projectId, String message, XmlPullParserException cause )
|
||||||
String message,
|
{
|
||||||
|
this( message, projectId, (URI) null, cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, ArtifactResolutionException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, InvalidRepositoryException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, ArtifactNotFoundException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, File pomLocation,
|
||||||
ArtifactResolutionException cause )
|
ArtifactResolutionException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
ArtifactNotFoundException cause )
|
*/
|
||||||
{
|
public ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
super( message, cause );
|
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
|
||||||
String message,
|
|
||||||
String pomLocation,
|
|
||||||
ArtifactResolutionException cause )
|
ArtifactResolutionException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message, File pomLocation, ArtifactNotFoundException cause )
|
||||||
String message,
|
{
|
||||||
String pomLocation,
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
ArtifactNotFoundException cause )
|
ArtifactNotFoundException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
public ProjectBuildingException( String projectId, String message, File pomLocation,
|
||||||
String message,
|
|
||||||
String pomLocation,
|
|
||||||
InvalidVersionSpecificationException cause )
|
InvalidVersionSpecificationException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation,
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
|
InvalidVersionSpecificationException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuildingException( String projectId, String message, File pomLocation,
|
||||||
InvalidDependencyVersionException cause )
|
InvalidDependencyVersionException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ProjectBuildingException( String projectId,
|
/**
|
||||||
String message,
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
String pomLocation,
|
*/
|
||||||
|
public ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
|
InvalidDependencyVersionException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ProjectBuildingException( String projectId, String message, File pomLocation,
|
||||||
ModelInterpolationException cause )
|
ModelInterpolationException cause )
|
||||||
{
|
{
|
||||||
super( message, cause );
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
this.projectId = projectId;
|
|
||||||
this.pomLocation = pomLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link File} or {@link URI} constructors for pomLocation
|
||||||
|
*/
|
||||||
|
protected ProjectBuildingException( String projectId, String message, String pomLocation,
|
||||||
|
ModelInterpolationException cause )
|
||||||
|
{
|
||||||
|
this( projectId, message, pomLocation, (Throwable) cause );
|
||||||
|
}
|
||||||
|
|
||||||
|
public URI getPomUri()
|
||||||
|
{
|
||||||
|
return pomUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use {@link #getPomUri()}
|
||||||
|
*/
|
||||||
public String getPomLocation()
|
public String getPomLocation()
|
||||||
{
|
{
|
||||||
return pomLocation;
|
if ( "file".equals( getPomUri().getScheme() ) )
|
||||||
|
{
|
||||||
|
return new File( getPomUri() ).getAbsolutePath();
|
||||||
|
}
|
||||||
|
return getPomUri().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProjectId()
|
public String getProjectId()
|
||||||
|
@ -192,7 +293,6 @@ public class ProjectBuildingException
|
||||||
public String getMessage()
|
public String getMessage()
|
||||||
{
|
{
|
||||||
return super.getMessage() + " for project " + projectId
|
return super.getMessage() + " for project " + projectId
|
||||||
+ ( ( pomLocation == null ? "" : " at " + pomLocation ) );
|
+ ( ( getPomUri() == null ? "" : " at " + getPomLocation() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue