mirror of https://github.com/apache/maven.git
o cleaning up tests in order to move them to the core using core components, and removing superfluous/repeated tests
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@796740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
03c8b58235
commit
4179dbcd41
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.Maven;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
@ -36,11 +37,15 @@ public abstract class AbstractCoreMavenComponentTestCase
|
|||
@Requirement
|
||||
protected org.apache.maven.project.ProjectBuilder projectBuilder;
|
||||
|
||||
@Requirement
|
||||
protected Maven maven;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
repositorySystem = lookup( RepositorySystem.class );
|
||||
projectBuilder = lookup( org.apache.maven.project.ProjectBuilder.class );
|
||||
maven = lookup( Maven.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,171 +0,0 @@
|
|||
package org.apache.maven.embedder;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.codehaus.plexus.util.Os;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.cli.CommandLineUtils;
|
||||
|
||||
public abstract class AbstractEmbedderTestCase
|
||||
extends PlexusTestCase
|
||||
{
|
||||
protected MavenEmbedder maven;
|
||||
|
||||
private List defaultPathList;
|
||||
|
||||
/**
|
||||
* The file extensions used to resolve command names to executables. Each extension must have a leading period.
|
||||
*/
|
||||
private List commandExtensions;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
Configuration configuration = new SimpleConfiguration();
|
||||
|
||||
maven = new MavenEmbedder( configuration );
|
||||
|
||||
// Some help with detecting executables on the command line. We want, in some cases, to use tools that are available on the command line
|
||||
// but if they are not present on the machine we don't want tests to fail. Case in point would be using SVN via the SCM plugin. We'll
|
||||
// run it if we can, pass through gracefully otherwise.
|
||||
|
||||
Properties env = CommandLineUtils.getSystemEnvVars( !Os.isFamily( Os.FAMILY_WINDOWS ) );
|
||||
|
||||
String defaultPath = env.getProperty( "PATH" );
|
||||
|
||||
if ( defaultPath == null )
|
||||
{
|
||||
defaultPathList = Collections.EMPTY_LIST;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringTokenizer tokenizer = new StringTokenizer( defaultPath, File.pathSeparator );
|
||||
|
||||
defaultPathList = new LinkedList();
|
||||
|
||||
while ( tokenizer.hasMoreElements() )
|
||||
{
|
||||
String element = (String) tokenizer.nextElement();
|
||||
|
||||
defaultPathList.add( element );
|
||||
}
|
||||
}
|
||||
|
||||
String pathExt = env.getProperty( "PATHEXT" );
|
||||
|
||||
if ( pathExt == null )
|
||||
{
|
||||
commandExtensions = Collections.EMPTY_LIST;
|
||||
}
|
||||
else
|
||||
{
|
||||
commandExtensions = Arrays.asList( pathExt.split( "\\" + File.pathSeparatorChar + "+" ) );
|
||||
}
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
maven.stop();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ExecutableResolver Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
public List getDefaultPath()
|
||||
{
|
||||
return defaultPathList;
|
||||
}
|
||||
|
||||
public File findExecutable( String executable )
|
||||
{
|
||||
return findExecutable( executable, getDefaultPath() );
|
||||
}
|
||||
|
||||
public File findExecutable( String executable, List path )
|
||||
{
|
||||
if ( StringUtils.isEmpty( executable ) )
|
||||
{
|
||||
throw new NullPointerException( "executable cannot be null" );
|
||||
}
|
||||
|
||||
if ( path == null )
|
||||
{
|
||||
throw new NullPointerException( "path cannot be null" );
|
||||
}
|
||||
|
||||
File f = new File( executable );
|
||||
|
||||
if ( f.isAbsolute() && f.isFile() )
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
if ( path == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( Iterator it = path.iterator(); it.hasNext(); )
|
||||
{
|
||||
String s = (String) it.next();
|
||||
|
||||
for ( Iterator ite = commandExtensions.iterator(); ite.hasNext(); )
|
||||
{
|
||||
String ext = (String) ite.next();
|
||||
|
||||
f = new File( s, executable + ext );
|
||||
|
||||
if ( f.isFile() )
|
||||
{
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = new File( s, executable );
|
||||
|
||||
if ( f.isFile() )
|
||||
{
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasExecutable( String executable )
|
||||
{
|
||||
return hasExecutable( executable, getDefaultPath() );
|
||||
}
|
||||
|
||||
public boolean hasExecutable( String executable, List path )
|
||||
{
|
||||
return findExecutable( executable, path ) != null;
|
||||
}
|
||||
}
|
|
@ -91,13 +91,6 @@ public class MavenEmbedderAligningBasedirTest
|
|||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( targetDirectory )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[]{"package"} ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package org.apache.maven.embedder;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/** @author Jason van Zyl */
|
||||
public class MavenEmbedderBehaviorTest
|
||||
extends AbstractEmbedderTestCase
|
||||
{
|
||||
public void testThatTheLocalRepositoryIsTakenFromGlobalSettingsWhenUserSettingsAreNull()
|
||||
throws Exception
|
||||
{
|
||||
/* FIXME:
|
||||
The embedder transforms the config into a request which in turn will pick the default value for
|
||||
the user settings and these override the global settings. I.e. setting the user settings file to
|
||||
null in the config has not the effect of suppressing my user settings from being loaded...
|
||||
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
Configuration configuration = new DefaultConfiguration()
|
||||
.setClassLoader( classLoader )
|
||||
.setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() )
|
||||
.setUserSettingsFile( null )
|
||||
.setGlobalSettingsFile( new File( getBasedir(), "src/test/resources/settings/valid-settings.xml" ) );
|
||||
|
||||
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
|
||||
|
||||
assertTrue( result.isValid() );
|
||||
|
||||
MavenEmbedder maven = new MavenEmbedder( configuration );
|
||||
|
||||
File expectedPath = new File( "/global/maven/local-repository" ).getCanonicalFile();
|
||||
File actualPath = new File( maven.getLocalRepository().getBasedir() );
|
||||
assertEquals( expectedPath, actualPath );
|
||||
|
||||
maven.stop();
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
package org.apache.maven.embedder;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
public class MavenEmbedderExampleTest
|
||||
extends PlexusTestCase
|
||||
{
|
||||
public void testEmbedderExample()
|
||||
throws Exception
|
||||
{
|
||||
/*
|
||||
|
||||
// START SNIPPET: simple-embedder-example
|
||||
|
||||
File projectDirectory = new File( getBasedir(), "src/examples/simple-project" );
|
||||
|
||||
File user = new File( projectDirectory, "settings.xml" );
|
||||
|
||||
Configuration configuration = new DefaultConfiguration()
|
||||
.setUserSettingsFile( user )
|
||||
.setClassLoader( Thread.currentThread().getContextClassLoader() );
|
||||
|
||||
ConfigurationValidationResult validationResult = MavenEmbedder.validateConfiguration( configuration );
|
||||
|
||||
if ( validationResult.isValid() )
|
||||
{
|
||||
MavenEmbedder embedder = new MavenEmbedder( configuration );
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( projectDirectory )
|
||||
.setGoals( Arrays.asList( new String[]{"clean", "install"} ) );
|
||||
|
||||
MavenExecutionResult result = embedder.execute( request );
|
||||
|
||||
if ( result.hasExceptions() )
|
||||
{
|
||||
fail( ((Exception)result.getExceptions().get( 0 )).getMessage() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// You may want to inspect the project after the execution.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MavenProject project = result.getProject();
|
||||
|
||||
// Do something with the project
|
||||
|
||||
String groupId = project.getGroupId();
|
||||
|
||||
String artifactId = project.getArtifactId();
|
||||
|
||||
String version = project.getVersion();
|
||||
|
||||
String name = project.getName();
|
||||
|
||||
String environment = project.getProperties().getProperty( "environment" );
|
||||
|
||||
assertEquals( "development", environment );
|
||||
|
||||
System.out.println( "You are working in the '" + environment + "' environment!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! validationResult.isUserSettingsFilePresent() )
|
||||
{
|
||||
System.out.println( "The specific user settings file '" + user + "' is not present." );
|
||||
}
|
||||
else if ( ! validationResult.isUserSettingsFileParses() )
|
||||
{
|
||||
System.out.println( "Please check your settings file, it is not well formed XML." );
|
||||
}
|
||||
}
|
||||
|
||||
// END SNIPPET: simple-embedder-example
|
||||
}
|
||||
|
||||
public void testEmbedderExampleThatShowsHowToMimicTheMavenCLI()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
// START SNIPPET: mimic-cli
|
||||
Configuration configuration = new DefaultConfiguration()
|
||||
.setUserSettingsFile( MavenEmbedder.DEFAULT_USER_SETTINGS_FILE )
|
||||
.setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE )
|
||||
.setClassLoader( Thread.currentThread().getContextClassLoader() );
|
||||
|
||||
ConfigurationValidationResult validationResult = MavenEmbedder.validateConfiguration( configuration );
|
||||
|
||||
if ( validationResult.isValid() )
|
||||
{
|
||||
// If the configuration is valid then do your thang ...
|
||||
}
|
||||
// END SNIPPET: mimic-cli
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public void testEmbedderExampleThatShowsAccessingThePlexusContainer()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
// START SNIPPET: plexus-container
|
||||
Configuration configuration = new DefaultConfiguration()
|
||||
.setUserSettingsFile( MavenEmbedder.DEFAULT_USER_SETTINGS_FILE )
|
||||
.setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE )
|
||||
.setClassLoader( Thread.currentThread().getContextClassLoader() );
|
||||
|
||||
ConfigurationValidationResult validationResult = MavenEmbedder.validateConfiguration( configuration );
|
||||
|
||||
if ( validationResult.isValid() )
|
||||
{
|
||||
// If the configuration is valid then do your thang ...
|
||||
}
|
||||
|
||||
MavenEmbedder embedder = new MavenEmbedder( configuration );
|
||||
|
||||
PlexusContainer container = embedder.getPlexusContainer();
|
||||
|
||||
// Do what you like with the container ...
|
||||
|
||||
// END SNIPPET: plexus-container
|
||||
}
|
||||
}
|
|
@ -27,7 +27,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionResult;
|
||||
import org.apache.maven.model.Build;
|
||||
|
@ -95,41 +94,6 @@ public class MavenEmbedderTest
|
|||
fail( "Encountered Exceptions in MavenExecutionResult during " + getName() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Goal/Phase execution tests
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
public void testExecutionUsingABaseDirectory()
|
||||
throws Exception
|
||||
{
|
||||
File testDirectory = new File( basedir, "src/test/embedder-test-project" );
|
||||
|
||||
File targetDirectory = new File( basedir, "target/embedder-test-project0" );
|
||||
|
||||
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
|
||||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( targetDirectory )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[]{"package"} ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
||||
MavenProject project = result.getProject();
|
||||
|
||||
assertEquals( "embedder-test-project", project.getArtifactId() );
|
||||
|
||||
File jar = new File( targetDirectory, "target/embedder-test-project-1.0-SNAPSHOT.jar" );
|
||||
|
||||
assertTrue( jar.exists() );
|
||||
}
|
||||
|
||||
public void testWithOptionalDependencies()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -141,13 +105,6 @@ public class MavenEmbedderTest
|
|||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( targetDirectory )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "install" } ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
|
||||
if (result.hasExceptions() )
|
||||
|
@ -156,8 +113,7 @@ public class MavenEmbedderTest
|
|||
fail( "Project didn't execute correctly.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*MNG-3919*/
|
||||
public void testWithInvalidGoal()
|
||||
throws Exception
|
||||
|
@ -168,10 +124,8 @@ public class MavenEmbedderTest
|
|||
|
||||
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( targetDirectory )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[]{"validate"} ) );
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
request.setGoals( Arrays.asList( new String[]{"validate"} ) );
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
List<Exception> exceptions = result.getExceptions();
|
||||
|
@ -194,12 +148,6 @@ public class MavenEmbedderTest
|
|||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setPom( new File( targetDirectory, "pom.xml" ) ).setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "package" } ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
@ -226,13 +174,6 @@ public class MavenEmbedderTest
|
|||
|
||||
MavenExecutionRequest requestWithoutProfile = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest requestWithoutProfile = new DefaultMavenExecutionRequest()
|
||||
.setPom( new File( targetDirectory, "pom.xml" ) )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "validate" } ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult r0 = mavenEmbedder.execute( requestWithoutProfile );
|
||||
|
||||
assertNoExceptions( r0 );
|
||||
|
@ -250,21 +191,10 @@ public class MavenEmbedderTest
|
|||
MavenExecutionRequest request = createMavenExecutionRequest( new File( targetDirectory, "pom.xml" ) );
|
||||
request.addActiveProfile( "embedderProfile" );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setPom( new File( targetDirectory, "pom.xml" ) )
|
||||
.setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "validate" } ) )
|
||||
.addActiveProfile( "embedderProfile" );
|
||||
*/
|
||||
|
||||
MavenExecutionResult r1 = mavenEmbedder.execute( request );
|
||||
|
||||
MavenProject p1 = r1.getProject();
|
||||
|
||||
System.out.println( p1 );
|
||||
System.out.println( p1.getProperties() );
|
||||
|
||||
assertEquals( "true", p1.getProperties().getProperty( "embedderProfile" ) );
|
||||
|
||||
assertEquals( "jason", p1.getProperties().getProperty( "name" ) );
|
||||
|
@ -303,11 +233,6 @@ public class MavenEmbedderTest
|
|||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( pom );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setPom( pom ).setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "package" } ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = mavenEmbedder.execute( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
@ -324,12 +249,7 @@ public class MavenEmbedderTest
|
|||
writer.close();
|
||||
|
||||
request = createMavenExecutionRequest( pom );
|
||||
|
||||
/*
|
||||
request = new DefaultMavenExecutionRequest().setPom( pom ).setShowErrors( true )
|
||||
.setGoals( Arrays.asList( new String[] { "package" } ) );
|
||||
*/
|
||||
|
||||
|
||||
result = mavenEmbedder.execute( request );
|
||||
|
||||
assertNoExceptions( result );
|
||||
|
|
|
@ -36,8 +36,6 @@ public class MavenEmbedderCrappySettingsConfigurationTest
|
|||
public void testEmbedderWillStillStartupWhenTheSettingsConfigurationIsCrap()
|
||||
throws Exception
|
||||
{
|
||||
// START SNIPPET: simple-embedder-example
|
||||
|
||||
File projectDirectory = getTestFile( "src/examples/simple-project" );
|
||||
|
||||
File user = new File( projectDirectory, "invalid-settings.xml" );
|
||||
|
@ -51,23 +49,10 @@ public class MavenEmbedderCrappySettingsConfigurationTest
|
|||
|
||||
MavenEmbedder embedder = new MavenEmbedder( configuration );
|
||||
|
||||
//assertNotNull( embedder.getLocalRepository().getBasedir() );
|
||||
|
||||
MavenExecutionRequest request = createMavenExecutionRequest( new File( projectDirectory, "pom.xml" ) );
|
||||
|
||||
/*
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
||||
.setBaseDirectory( projectDirectory )
|
||||
.setGoals( Arrays.asList( new String[]{"validate"} ) );
|
||||
*/
|
||||
|
||||
MavenExecutionResult result = embedder.execute( request );
|
||||
|
||||
for ( Exception e : result.getExceptions() )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
assertFalse( result.hasExceptions() );
|
||||
|
||||
assertNotNull( result.getProject() );
|
||||
|
@ -77,8 +62,6 @@ public class MavenEmbedderCrappySettingsConfigurationTest
|
|||
String environment = project.getProperties().getProperty( "environment" );
|
||||
|
||||
assertEquals( "development", environment );
|
||||
|
||||
// END SNIPPET: simple-embedder-example
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue