mirror of https://github.com/apache/maven.git
buildWithDependencies in the embedder shouldn't check for distribution status by default. Add test.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@570550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
50c099ba54
commit
07c6e661f9
|
@ -315,22 +315,10 @@ public class MavenEmbedderTest
|
|||
throws Exception
|
||||
{
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
|
||||
.setPomFile( getPomFile().getAbsolutePath() ).setShowErrors( true );
|
||||
.setPomFile( getPomFile().getAbsolutePath() );
|
||||
|
||||
MavenExecutionResult result = maven.readProjectWithDependencies( request );
|
||||
|
||||
if ( result.hasExceptions() )
|
||||
{
|
||||
for ( Iterator i = result.getExceptions().iterator(); i.hasNext(); )
|
||||
{
|
||||
Exception e = (Exception) i.next();
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
fail( "Exception is readProjectWithDependencies() test." );
|
||||
}
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
||||
assertEquals( "org.apache.maven", result.getMavenProject().getGroupId() );
|
||||
|
@ -354,16 +342,30 @@ public class MavenEmbedderTest
|
|||
|
||||
assertNoExceptions( result );
|
||||
|
||||
// Iterator it = result.getMavenProject().getTestClasspathElements().iterator();
|
||||
// while(it.hasNext()) {
|
||||
// Object object = (Object) it.next();
|
||||
// System.out.println(" element=" + object);
|
||||
// }
|
||||
|
||||
// sources, test sources, and the junit jar..
|
||||
assertEquals( 3, result.getMavenProject().getTestClasspathElements().size() );
|
||||
}
|
||||
|
||||
public void testProjectReadingWithDistributionStatus()
|
||||
throws Exception
|
||||
{
|
||||
File pom = new File( basedir, "src/test/resources/pom-with-distribution-status.xml" );
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
|
||||
.setPomFile( pom.getAbsolutePath() );
|
||||
|
||||
MavenProject project = maven.readProject( pom );
|
||||
|
||||
assertEquals( "deployed", project.getDistributionManagement().getStatus() );
|
||||
|
||||
MavenExecutionResult result = maven.readProjectWithDependencies( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
||||
assertEquals( "org.apache.maven", result.getMavenProject().getGroupId() );
|
||||
|
||||
assertEquals( "deployed", result.getMavenProject().getDistributionManagement().getStatus() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Model Writing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>1.0</version>
|
||||
<distributionManagement>
|
||||
<status>deployed</status>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -332,7 +332,7 @@ public class DefaultMavenProjectBuilder
|
|||
TransferListener transferListener )
|
||||
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
MavenProject project = build( projectDescriptor, localRepository, profileManager );
|
||||
MavenProject project = build( projectDescriptor, localRepository, profileManager, false );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Typically when the project builder is being used from maven proper
|
||||
|
|
Loading…
Reference in New Issue