You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ca...@apache.org on 2006/08/15 03:57:16 UTC
svn commit: r431484 - in /maven/continuum/trunk:
continuum-api/src/main/java/org/apache/maven/continuum/project/builder/
continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/
continuum-core/src/main/java/org/apache/maven/continuum...
Author: carlos
Date: Mon Aug 14 18:57:15 2006
New Revision: 431484
URL: http://svn.apache.org/viewvc?rev=431484&view=rev
Log:
[CONTINUUM-777] Handle errors when adding new projects
Submitted By: Joakim Erdfelt
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java Mon Aug 14 18:57:15 2006
@@ -44,8 +44,28 @@
public static final String ERROR_MISSING_ARTIFACTID = "add.project.missing.artifactid.error";
- public static final String ERROR_UNKNOWN = "add.project.unknown.error";
+ public static final String ERROR_POM_NOT_FOUND = "add.project.missing.pom.error";
+
+ public static final String ERROR_MISSING_VERSION = "add.project.missing.version.error";
+
+ public static final String ERROR_MISSING_NAME = "add.project.missing.name.error";
+
+ public static final String ERROR_MISSING_REPOSITORY = "add.project.missing.repository.error";
+
+ public static final String ERROR_MISSING_SCM = "add.project.missing.scm.error";
+
+ public static final String ERROR_MISSING_SCM_CONNECTION = "add.project.missing.scm.connection.error";
+
+ public static final String ERROR_MISSING_NOTIFIER_TYPE = "add.project.missing.notifier.type.error";
+
+ public static final String ERROR_MISSING_NOTIFIER_CONFIGURATION = "add.project.missing.notifier.configuration.error";
+
+ public static final String ERROR_METADATA_TRANSFER = "add.project.metadata.transfer.error";
+
+ public static final String ERROR_VALIDATION = "add.project.validation.error";
+ public static final String ERROR_UNKNOWN = "add.project.unknown.error";
+
private List projects = new ArrayList();
private List projectGroups = new ArrayList();
@@ -99,7 +119,29 @@
{
errors.add( errorKey );
}
-
+
+ /**
+ * Add an error that happened during adding the project to Continuum.
+ *
+ * @param errorKey error id (so it can be internationalized later)
+ */
+ public void addError( String errorKey, Object param )
+ {
+ // TODO: store the parameters.
+ errors.add( errorKey );
+ }
+
+ /**
+ * Add an error that happened during adding the project to Continuum.
+ *
+ * @param errorKey error id (so it can be internationalized later)
+ */
+ public void addError( String errorKey, Object params[] )
+ {
+ // TODO: store the parameters.
+ errors.add( errorKey );
+ }
+
/**
* Get the warnings that happened during adding the project to Continuum.
* There is an entry with the warning key (so it can be internationalized later) for each warning.
@@ -121,5 +163,15 @@
public List getErrors()
{
return errors;
+ }
+
+ /**
+ * Quick check to see if there are any errors.
+ *
+ * @return boolean indicating if there are any errors.
+ */
+ public boolean hasErrors()
+ {
+ return ( errors != null ) && ( !errors.isEmpty() );
}
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/DefaultMavenOneMetadataHelper.java Mon Aug 14 18:57:15 2006
@@ -29,6 +29,7 @@
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
@@ -74,7 +75,14 @@
return;
}
- // TODO catch other IO exceptions and handle them more appropiately?
+ catch ( FileNotFoundException e )
+ {
+ result.addError( ContinuumProjectBuildingResult.ERROR_POM_NOT_FOUND );
+
+ getLogger().info( "Error while reading maven POM (" + e.getMessage() + ").", e );
+
+ return;
+ }
catch ( IOException e )
{
result.addError( ContinuumProjectBuildingResult.ERROR_UNKNOWN );
@@ -127,7 +135,7 @@
getLogger().info( "Missing 'groupId' element in the POM." );
- return;
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
artifactId = getValue( mavenProject, "artifactId", project.getArtifactId() );
@@ -138,7 +146,7 @@
getLogger().info( "Missing 'artifactId' element in the POM." );
- return;
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
}
@@ -150,8 +158,9 @@
if ( StringUtils.isEmpty( project.getVersion() ) && StringUtils.isEmpty( version ) )
{
- // TODO add to result and don't throw exception
- throw new MavenOneMetadataHelperException( "Missing 'version' element in the POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_VERSION );
+
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
// ----------------------------------------------------------------------
@@ -162,8 +171,9 @@
if ( StringUtils.isEmpty( project.getName() ) && StringUtils.isEmpty( name ) )
{
- // TODO add to result and don't throw exception
- throw new MavenOneMetadataHelperException( "Missing 'name' element in POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NAME );
+
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
// ----------------------------------------------------------------------
@@ -180,7 +190,7 @@
Xpp3Dom repository = mavenProject.getChild( "repository" );
- String scmConnection;
+ String scmConnection = null;
if ( repository == null )
{
@@ -190,8 +200,9 @@
}
else
{
- // TODO add to result and don't throw exception
- throw new MavenOneMetadataHelperException( "Missing 'repository' element in the POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_REPOSITORY );
+
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
}
else
@@ -202,9 +213,9 @@
if ( StringUtils.isEmpty( scmConnection ) )
{
- // TODO add to result and don't throw exception
- throw new MavenOneMetadataHelperException(
- "Missing both anonymous and developer SCM connection URLs." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM );
+
+ // Do not throw an exception or return here, gather up as many results as possible first.
}
}
@@ -318,6 +329,16 @@
notifiers.add( notif );
}
}
+ }
+
+ // ----------------------------------------------------------------------
+ // Handle Errors / Results
+ // ----------------------------------------------------------------------
+
+ if ( result.hasErrors() )
+ {
+ // prevent project creation if there are errors.
+ return;
}
// ----------------------------------------------------------------------
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java Mon Aug 14 18:57:15 2006
@@ -24,6 +24,7 @@
import org.apache.maven.continuum.model.project.ProjectDependency;
import org.apache.maven.continuum.model.project.ProjectDeveloper;
import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Developer;
import org.apache.maven.model.Model;
@@ -112,9 +113,18 @@
mapMavenProjectToContinuumProject( getMavenProject( metadata ), continuumProject );
}
+ /**
+ * @deprecated use {@link #mapMavenProjectToContinuumProject(ContinuumProjectBuildingResult, MavenProject, Project)} instead.
+ */
public void mapMavenProjectToContinuumProject( MavenProject mavenProject, Project continuumProject )
throws MavenBuilderHelperException
{
+ mapMavenProjectToContinuumProject( new ContinuumProjectBuildingResult(), mavenProject, continuumProject );
+ }
+
+ public void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject, Project continuumProject )
+ {
+
// ----------------------------------------------------------------------
// Name
// ----------------------------------------------------------------------
@@ -144,7 +154,8 @@
}
else
{
- throw new MavenBuilderHelperException( "Missing 'groupId' element in the POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
+ return;
}
// ----------------------------------------------------------------------
@@ -157,7 +168,8 @@
}
else
{
- throw new MavenBuilderHelperException( "Missing 'artifactId' element in the POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_ARTIFACTID );
+ return;
}
// ----------------------------------------------------------------------
@@ -276,7 +288,11 @@
}
}
- continuumProject.setNotifiers( getNotifiers( mavenProject ) );
+ List notifiers = getNotifiers( result, mavenProject );
+ if ( notifiers != null )
+ {
+ continuumProject.setNotifiers( notifiers );
+ }
for ( Iterator i = userNotifiers.iterator(); i.hasNext(); )
{
@@ -285,12 +301,20 @@
continuumProject.addNotifier( notifier );
}
}
-
+
+ /**
+ * @deprecated use {@link #getMavenProject(ContinuumProjectBuildingResult, File)} instead.
+ */
public MavenProject getMavenProject( File file )
- throws MavenBuilderHelperException
+ throws MavenBuilderHelperException
{
- MavenProject project;
+ return getMavenProject( new ContinuumProjectBuildingResult(), file );
+ }
+ public MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file )
+ {
+ MavenProject project;
+
try
{
// TODO: This seems like code that is shared with DefaultMaven, so it should be moved to the project
@@ -326,7 +350,9 @@
{
for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
{
- messages.append( (String) i.next() );
+ String valmsg = (String) i.next();
+ result.addError( ContinuumProjectBuildingResult.ERROR_VALIDATION, valmsg );
+ messages.append( valmsg );
messages.append( "\n" );
}
}
@@ -335,9 +361,8 @@
String msg = "Cannot build maven project from " + file + " (" + e.getMessage() + ").\n" + messages;
getLogger().error( msg, e );
-
- // TODO add to result and don't throw exception
- throw new MavenBuilderHelperException( msg, e );
+
+ return null;
}
// ----------------------------------------------------------------------
@@ -349,18 +374,22 @@
if ( scm == null )
{
- // TODO add to result and don't throw exception
- throw new MavenBuilderHelperException(
- "Missing 'scm' element in the " + getProjectName( project ) + " POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM, getProjectName( project ) );
+
+ getLogger().error( "Missing 'scm' element in the " + getProjectName( project ) + " POM." );
+
+ return null;
}
String url = scm.getConnection();
if ( StringUtils.isEmpty( url ) )
{
- // TODO add to result and don't throw exception
- throw new MavenBuilderHelperException(
- "Missing 'connection' element in the 'scm' element in the " + getProjectName( project ) + " POM." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_SCM_CONNECTION, getProjectName( project ) );
+
+ getLogger().error( "Missing 'connection' element in the 'scm' element in the " + getProjectName( project ) + " POM." );
+
+ return null;
}
return project;
@@ -392,8 +421,7 @@
return project.getScm().getConnection();
}
- private List getNotifiers( MavenProject mavenProject )
- throws MavenBuilderHelperException
+ private List getNotifiers( ContinuumProjectBuildingResult result, MavenProject mavenProject )
{
List notifiers = new ArrayList();
@@ -407,14 +435,16 @@
if ( StringUtils.isEmpty( projectNotifier.getType() ) )
{
- throw new MavenBuilderHelperException( "Missing type from notifier." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_TYPE );
+ return null;
}
notifier.setType( projectNotifier.getType() );
if ( projectNotifier.getConfiguration() == null )
{
- throw new MavenBuilderHelperException( "Notifier configuration cannot be null." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_CONFIGURATION );
+ return null;
}
notifier.setConfiguration( projectNotifier.getConfiguration() );
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java Mon Aug 14 18:57:15 2006
@@ -17,6 +17,7 @@
*/
import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.project.MavenProject;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -32,12 +33,22 @@
void mapMetadataToProject( File metadata, Project project )
throws MavenBuilderHelperException;
-
+
+ /**
+ * @deprecated use {@link #getMavenProject(ContinuumProjectBuildingResult, File)} instead.
+ */
MavenProject getMavenProject( File file )
- throws MavenBuilderHelperException;
+ throws MavenBuilderHelperException;
+
+ MavenProject getMavenProject( ContinuumProjectBuildingResult result, File file );
+ /**
+ * @deprecated use {@link #mapMavenProjectToContinuumProject(ContinuumProjectBuildingResult, MavenProject, Project)} instead.
+ */
void mapMavenProjectToContinuumProject( MavenProject mavenProject, Project continuumProject )
throws MavenBuilderHelperException;
+
+ void mapMavenProjectToContinuumProject( ContinuumProjectBuildingResult result, MavenProject mavenProject, Project continuumProject );
ArtifactRepository getLocalRepository();
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java Mon Aug 14 18:57:15 2006
@@ -32,7 +32,6 @@
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
-import java.io.IOException;
import java.net.URL;
/**
@@ -78,7 +77,7 @@
{
metadataHelper.mapMetadata( result, pomFile, project );
- if ( result.getErrors().size() > 0 )
+ if ( result.hasErrors() )
{
return result;
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java Mon Aug 14 18:57:15 2006
@@ -17,7 +17,6 @@
*/
import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelper;
-import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelperException;
import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -30,7 +29,6 @@
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.apache.maven.continuum.utils.ContinuumUtils;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
@@ -94,21 +92,23 @@
{
MavenProject mavenProject;
- try
- {
- mavenProject = builderHelper.getMavenProject( createMetadataFile( url, username, password ) );
+ try {
+ mavenProject = builderHelper.getMavenProject( result, createMetadataFile( url, username, password ) );
+
+ if( (result != null) && result.hasErrors())
+ {
+ return;
+ }
}
- catch ( MavenBuilderHelperException e )
+ catch (MalformedURLException e)
{
- // TODO add to result with error key
- result.addWarning( e.getMessage() );
-
+ result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
+
return;
}
catch ( IOException e )
{
- // TODO add to result with error key
- result.addWarning( "Could not download " + url + ": " + e.getMessage() );
+ result.addError( ContinuumProjectBuildingResult.ERROR_METADATA_TRANSFER );
return;
}
@@ -157,15 +157,7 @@
continuumProject.addBuildDefinition( bd );
- try
- {
- builderHelper.mapMavenProjectToContinuumProject( mavenProject, continuumProject );
- }
- catch ( MavenBuilderHelperException e )
- {
- // TODO add to result with error key
- result.addError( ContinuumUtils.throwableToString( e ) );
- }
+ builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject );
result.addProject( continuumProject, MavenTwoBuildExecutor.ID );
}
@@ -203,8 +195,7 @@
}
catch ( MalformedURLException e )
{
- // TODO add to result with error key
- result.addError( "Could not download project from '" + urlString + "'." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL, urlString );
continue;
}
@@ -223,8 +214,7 @@
if ( StringUtils.isEmpty( mavenProject.getGroupId() ) )
{
- // TODO add to result with error key
- result.addError( "groupId is null." );
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
return null;
}
Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java Mon Aug 14 18:57:15 2006
@@ -49,9 +49,9 @@
ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null );
- assertNotNull( result.getWarnings() );
+ assertNotNull( result.getErrors() );
- assertEquals( 0, result.getWarnings().size() );
+ assertEquals( 0, result.getErrors().size() );
assertNotNull( result.getProjects() );
@@ -80,9 +80,9 @@
ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null );
- assertNotNull( result.getWarnings() );
+ assertNotNull( result.getErrors() );
- assertEquals( 0, result.getWarnings().size() );
+ assertEquals( 0, result.getErrors().size() );
assertNotNull( result.getProjects() );
@@ -111,9 +111,9 @@
ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null );
- assertNotNull( result.getWarnings() );
+ assertNotNull( result.getErrors() );
- assertEquals( 0, result.getWarnings().size() );
+ assertEquals( 0, result.getErrors().size() );
assertNotNull( result.getProjects() );
@@ -163,12 +163,11 @@
// Assert the warnings
// ----------------------------------------------------------------------
- assertNotNull( result.getWarnings() );
+ assertNotNull( result.getErrors() );
- assertEquals( 1, result.getWarnings().size() );
+ assertEquals( 1, result.getErrors().size() );
- assertTrue( "Does not end with \"I'm-not-here-project/pom.xml\"",
- result.getWarnings().get( 0 ).toString().indexOf( "I'm-not-here-project/pom.xml" ) != -1 );
+ assertEquals( ContinuumProjectBuildingResult.ERROR_METADATA_TRANSFER, result.getErrors().get( 0 ).toString() );
// ----------------------------------------------------------------------
// Assert the project group built
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java Mon Aug 14 18:57:15 2006
@@ -73,7 +73,7 @@
result = continuum.addMavenOneProject( m1Pom );
- if ( result.getErrors().size() > 0 )
+ if ( result.hasErrors() )
{
Iterator it = result.getErrors().iterator();
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java Mon Aug 14 18:57:15 2006
@@ -16,17 +16,14 @@
* limitations under the License.
*/
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.MalformedURLException;
-import java.net.UnknownHostException;
-import java.util.Iterator;
-
import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.codehaus.plexus.util.StringUtils;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
/**
* @author Nick Gonzalez
* @version $Id$
@@ -78,7 +75,7 @@
result = continuum.addMavenTwoProject( m2Pom );
- if ( result.getErrors().size() > 0 )
+ if ( result.hasErrors() )
{
Iterator it = result.getErrors().iterator();
Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=431484&r1=431483&r2=431484&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Mon Aug 14 18:57:15 2006
@@ -106,9 +106,18 @@
add.project.unknown.host.error = The specified host is either unknown or inaccessible.
add.project.malformed.url.error = The URL provided is malformed.
add.project.xml.parse.error = The XML content of the POM can not be parsed.
-add.project.extend.error = Cannot use a POM with an 'extend' element
+add.project.extend.error = Cannot use a POM with an 'extend' element.
+add.project.missing.pom.error = Unable to read the POM file.
add.project.missing.groupid.error = Missing 'groupId' element in the POM.
add.project.missing.artifactid.error = Missing 'artifactId' element in the POM.
+add.project.missing.version.error = Missing 'version' element in the POM.
+add.project.missing.name.error = Missing 'name' element in the POM.
+add.project.missing.repository.error = Missing 'repository' element in the POM.
+add.project.missing.scm.error = Missing 'scm' element in the POM.
+add.project.missing.scm.connection.error = Missing 'connection' sub-element in the 'scm' element in the POM.
+add.project.missing.notifier.type.error = Missing 'type' sub-element in the 'notifier' element in the POM.
+add.project.missing.notifier.configuration.error = Missing 'configuration' sub-element in the 'notifier' element in the POM.
+add.project.metadata.transfer.error = Transfer of Metadata has failed.
add.project.unknown.error = The specified resource cannot be accessed.
# ----------------------------------------------------------------------