You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2018/11/29 19:19:51 UTC
[maven] branch MNG-6533 created (now d4866ac)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch MNG-6533
in repository https://gitbox.apache.org/repos/asf/maven.git.
at d4866ac [MNG-6533] Test: ProjectBuildingException miss reference to MavenProject
This branch includes the following new commits:
new d4866ac [MNG-6533] Test: ProjectBuildingException miss reference to MavenProject
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven] 01/01: [MNG-6533] Test: ProjectBuildingException miss
reference to MavenProject
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MNG-6533
in repository https://gitbox.apache.org/repos/asf/maven.git
commit d4866ac1ae4bab9b726c95b029a1623aac3d263c
Author: Mickael Istria <mi...@redhat.com>
AuthorDate: Thu Nov 29 18:26:46 2018 +0100
[MNG-6533] Test: ProjectBuildingException miss reference to MavenProject
---
.../apache/maven/project/ProjectBuilderTest.java | 27 ++++++++++++++++-
.../resources/projects/artifactMissingVersion.xml | 34 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
index 5511cb1..b143df6 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
@@ -20,17 +20,20 @@ package org.apache.maven.project;
*/
import java.io.File;
+import java.util.Collections;
import java.util.Properties;
import org.apache.maven.AbstractCoreMavenComponentTestCase;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelSource;
public class ProjectBuilderTest
extends AbstractCoreMavenComponentTestCase
{
- protected String getProjectsDirectory()
+ @Override
+ protected String getProjectsDirectory()
{
return "src/test/projects/project-builder";
}
@@ -84,4 +87,26 @@ public class ProjectBuilderTest
// this is expected
}
}
+
+ public void testReadErroneousMavenProjectContainsReference() throws Exception
+ {
+ File pomFile = new File( "src/test/resources/projects/artifactMissingVersion.xml" );
+ MavenSession mavenSession = createMavenSession( null );
+ ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
+ configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
+ configuration.setRepositorySession( mavenSession.getRepositorySession() );
+ org.apache.maven.project.ProjectBuilder projectBuilder = lookup( org.apache.maven.project.ProjectBuilder.class );
+ try {
+ projectBuilder.build( pomFile, configuration );
+ } catch ( ProjectBuildingException ex ) {
+ assertEquals( 1, ex.getResults().size() );
+ assertNotNull( ex.getResults().get(0).getProject() );
+ }
+ try {
+ projectBuilder.build( Collections.singletonList( pomFile ), false, configuration );
+ } catch ( ProjectBuildingException ex ) {
+ assertEquals( 1, ex.getResults().size() );
+ assertNotNull( ex.getResults().get(0).getProject() );
+ }
+ }
}
diff --git a/maven-core/src/test/resources/projects/artifactMissingVersion.xml b/maven-core/src/test/resources/projects/artifactMissingVersion.xml
new file mode 100644
index 0000000..802a3ac
--- /dev/null
+++ b/maven-core/src/test/resources/projects/artifactMissingVersion.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>markerTest</groupId>
+ <artifactId>testArtifactMissingVersion</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>missing</groupId>
+ <artifactId>missing</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>