summaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/maven2-repository/src/main
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-02-25 20:45:18 +0000
committerOlivier Lamy <olamy@apache.org>2012-02-25 20:45:18 +0000
commit57b5334aef407b28c8c58c3306968a5fd9206a58 (patch)
treeb7ce4d6127f4d3cf844382f2ec264a445e631e2c /archiva-modules/plugins/maven2-repository/src/main
parent99dd7f4baf662f4ea1a9ebc37fac5ec9f657a10b (diff)
downloadarchiva-57b5334aef407b28c8c58c3306968a5fd9206a58.tar.gz
archiva-57b5334aef407b28c8c58c3306968a5fd9206a58.zip
avoid failing on java profile or other profiles by using a TwoPhaseBuiling maven build model request
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1293680 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/maven2-repository/src/main')
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
index b1a1f78ce..503a52b76 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
@@ -43,6 +43,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeEx
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.reports.RepositoryProblemFacet;
import org.apache.archiva.xml.XMLException;
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.model.CiManagement;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.IssueManagement;
@@ -131,6 +132,7 @@ public class Maven2RepositoryStorage
{
DefaultModelBuilderFactory defaultModelBuilderFactory = new DefaultModelBuilderFactory();
builder = defaultModelBuilderFactory.newInstance();
+
}
public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId )
@@ -217,15 +219,17 @@ public class Maven2RepositoryStorage
}
}
- ModelBuildingRequest req = new DefaultModelBuildingRequest();
- req.setProcessPlugins( false );
- req.setPomFile( file );
+ ModelBuildingRequest req =
+ new DefaultModelBuildingRequest()
+ .setProcessPlugins( false )
+ .setPomFile( file )
+ .setTwoPhaseBuilding( true )
+ .setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
// MRM-1411
req.setModelResolver(
new RepositoryModelResolver( basedir, pathTranslator, wagonFactory, remoteRepositories, networkProxies,
repositoryConfiguration ) );
- req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
Model model;
try
@@ -241,8 +245,11 @@ public class Maven2RepositoryStorage
{
// MRM-1411, related to MRM-1335
// this means that the problem was that the parent wasn't resolved!
- if ( problem.getException() instanceof FileNotFoundException && e.getModelId() != null &&
- !e.getModelId().equals( problem.getModelId() ) )
+ // olamy really hackhish but fail with java profile so use error message
+ // || ( StringUtils.startsWith( problem.getMessage(), "Failed to determine Java version for profile" ) )
+ // but setTwoPhaseBuilding(true) fix that
+ if ( ( problem.getException() instanceof FileNotFoundException && e.getModelId() != null &&
+ !e.getModelId().equals( problem.getModelId() ) ) )
{
log.warn( "The artifact's parent POM file '" + file + "' cannot be resolved. " +
"Using defaults for project version metadata.." );
@@ -257,7 +264,9 @@ public class Maven2RepositoryStorage
metadata.addFacet( facet );
String errMsg =
- "Error in resolving artifact's parent POM file. " + problem.getException().getMessage();
+ "Error in resolving artifact's parent POM file. " + ( problem.getException() == null
+ ? problem.getMessage()
+ : problem.getException().getMessage() );
RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet();
repoProblemFacet.setRepositoryId( repoId );
repoProblemFacet.setId( repoId );