mirror of https://github.com/apache/maven.git
o Decoupled from alias and default-value where not necessary
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@723978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e587051f1
commit
f36f13f50d
|
@ -50,9 +50,6 @@ public class MavenIT0043Test
|
||||||
File child2 = new File( testDir, "test" );
|
File child2 = new File( testDir, "test" );
|
||||||
verifier = new Verifier( child2.getAbsolutePath() );
|
verifier = new Verifier( child2.getAbsolutePath() );
|
||||||
|
|
||||||
Properties systemProperties = new Properties();
|
|
||||||
systemProperties.put( "expression.expressions", "project/repositories,project/pluginRepositories" );
|
|
||||||
verifier.setSystemProperties( systemProperties );
|
|
||||||
verifier.setCliOptions( Collections.singletonList( "-s settings.xml" ) );
|
verifier.setCliOptions( Collections.singletonList( "-s settings.xml" ) );
|
||||||
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
|
@ -39,7 +39,11 @@ public class MavenIT0075Test
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0075" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0075" );
|
||||||
|
|
||||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.setAutoclean( false );
|
||||||
|
verifier.deleteDirectory( "sub1/target" );
|
||||||
|
verifier.deleteDirectory( "sub2/target" );
|
||||||
Properties systemProperties = new Properties();
|
Properties systemProperties = new Properties();
|
||||||
|
systemProperties.put( "expression.outputFile", "target/expression.properties" );
|
||||||
systemProperties.put( "activate", "anything" );
|
systemProperties.put( "activate", "anything" );
|
||||||
verifier.setSystemProperties( systemProperties );
|
verifier.setSystemProperties( systemProperties );
|
||||||
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
||||||
|
|
|
@ -39,8 +39,11 @@ public class MavenITmng2136ActiveByDefaultProfileTest
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2136" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2136" );
|
||||||
|
|
||||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.setAutoclean( false );
|
||||||
|
verifier.deleteDirectory( "target" );
|
||||||
|
|
||||||
Properties systemProperties = new Properties();
|
Properties systemProperties = new Properties();
|
||||||
|
systemProperties.put( "expression.outputFile", new File( testDir, "target/expression.properties" ).getPath() );
|
||||||
systemProperties.put( "expression.expressions", "project/properties" );
|
systemProperties.put( "expression.expressions", "project/properties" );
|
||||||
verifier.setSystemProperties( systemProperties );
|
verifier.setSystemProperties( systemProperties );
|
||||||
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-expression:2.1-SNAPSHOT:eval" );
|
||||||
|
|
|
@ -28,4 +28,17 @@ under the License.
|
||||||
|
|
||||||
<name>Maven Integration Test :: it0043 setup</name>
|
<name>Maven Integration Test :: it0043 setup</name>
|
||||||
<description>Preparation project with non-overriden URL to central for plugin download.</description>
|
<description>Preparation project with non-overriden URL to central for plugin download.</description>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-expression</artifactId>
|
||||||
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
<configuration>
|
||||||
|
<outputFile>target/expression.properties</outputFile>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -44,4 +44,21 @@ under the License.
|
||||||
<url>file:///${basedir}/target/maven-core-it0043-repo</url>
|
<url>file:///${basedir}/target/maven-core-it0043-repo</url>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-expression</artifactId>
|
||||||
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
<configuration>
|
||||||
|
<outputFile>target/expression.properties</outputFile>
|
||||||
|
<expressions>
|
||||||
|
<expression>project/repositories</expression>
|
||||||
|
<expression>project/pluginRepositories</expression>
|
||||||
|
</expressions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -48,7 +48,7 @@ under the License.
|
||||||
<goal>config</goal>
|
<goal>config</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputFile>target/dist.properties</outputFile>
|
<propertiesFile>target/dist.properties</propertiesFile>
|
||||||
<listParam>
|
<listParam>
|
||||||
<!-- Get the distro repo, just like the Maven Deploy Plugin would do -->
|
<!-- Get the distro repo, just like the Maven Deploy Plugin would do -->
|
||||||
<listParam>${project.distributionManagementArtifactRepository}</listParam>
|
<listParam>${project.distributionManagementArtifactRepository}</listParam>
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class InstanceofMojo
|
||||||
* The path to the properties file used to track the results of the instanceof tests.
|
* The path to the properties file used to track the results of the instanceof tests.
|
||||||
*
|
*
|
||||||
* @parameter expression="${clsldr.instanceofPropertiesFile}"
|
* @parameter expression="${clsldr.instanceofPropertiesFile}"
|
||||||
* default-value="${project.build.directory}/instanceof.properties"
|
|
||||||
*/
|
*/
|
||||||
private File instanceofPropertiesFile;
|
private File instanceofPropertiesFile;
|
||||||
|
|
||||||
|
|
|
@ -65,11 +65,38 @@ public class ConfigMojo
|
||||||
* The path to the properties file into which to save the mojo configuration. Unlike all the other parameters, this
|
* The path to the properties file into which to save the mojo configuration. Unlike all the other parameters, this
|
||||||
* parameter features both a default value and an alias.
|
* parameter features both a default value and an alias.
|
||||||
*
|
*
|
||||||
* @parameter alias="outputFile"
|
* @parameter expression="${config.propertiesFile}
|
||||||
* expression="${config.propertiesFile} default-value="${project.build.directory}/config.properties"
|
|
||||||
*/
|
*/
|
||||||
private File propertiesFile;
|
private File propertiesFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A parameter with an alias.
|
||||||
|
*
|
||||||
|
* @parameter alias="aliasParamLegacy"
|
||||||
|
*/
|
||||||
|
private String aliasParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A parameter with a constant default value.
|
||||||
|
*
|
||||||
|
* @parameter default-value="maven-core-it"
|
||||||
|
*/
|
||||||
|
private String defaultParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A parameter with a default value using multiple expressions.
|
||||||
|
*
|
||||||
|
* @parameter default-value="${project.groupId}:${project.artifactId}:${project.version}"
|
||||||
|
*/
|
||||||
|
private String defaultParamWithExpression;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A parameter that combines all of the annotations.
|
||||||
|
*
|
||||||
|
* @parameter alias="fullyAnnotatedParam" expression="${config.aliasDefaultExpressionParam}" default-value="test"
|
||||||
|
*/
|
||||||
|
private String aliasDefaultExpressionParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple parameter of type {@link java.lang.Boolean}.
|
* A simple parameter of type {@link java.lang.Boolean}.
|
||||||
*
|
*
|
||||||
|
@ -168,6 +195,13 @@ public class ConfigMojo
|
||||||
*/
|
*/
|
||||||
private String[] stringParams;
|
private String[] stringParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array parameter of component type {@link java.io.File}.
|
||||||
|
*
|
||||||
|
* @parameter
|
||||||
|
*/
|
||||||
|
private File[] fileParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection parameter of type {@link java.util.List}.
|
* A collection parameter of type {@link java.util.List}.
|
||||||
*
|
*
|
||||||
|
@ -276,6 +310,10 @@ public class ConfigMojo
|
||||||
* injected by Maven.
|
* injected by Maven.
|
||||||
*/
|
*/
|
||||||
dumpValue( props, "propertiesFile", propertiesFile );
|
dumpValue( props, "propertiesFile", propertiesFile );
|
||||||
|
dumpValue( props, "aliasParam", aliasParam );
|
||||||
|
dumpValue( props, "defaultParam", defaultParam );
|
||||||
|
dumpValue( props, "defaultParamWithExpression", defaultParamWithExpression );
|
||||||
|
dumpValue( props, "aliasDefaultExpressionParam", aliasDefaultExpressionParam );
|
||||||
dumpValue( props, "booleanParam", booleanParam );
|
dumpValue( props, "booleanParam", booleanParam );
|
||||||
dumpValue( props, "byteParam", byteParam );
|
dumpValue( props, "byteParam", byteParam );
|
||||||
dumpValue( props, "shortParam", shortParam );
|
dumpValue( props, "shortParam", shortParam );
|
||||||
|
@ -290,6 +328,7 @@ public class ConfigMojo
|
||||||
dumpValue( props, "urlParam", urlParam );
|
dumpValue( props, "urlParam", urlParam );
|
||||||
dumpValue( props, "uriParam", uriParam );
|
dumpValue( props, "uriParam", uriParam );
|
||||||
dumpValue( props, "stringParams", stringParams );
|
dumpValue( props, "stringParams", stringParams );
|
||||||
|
dumpValue( props, "fileParams", fileParams );
|
||||||
dumpValue( props, "listParam", listParam );
|
dumpValue( props, "listParam", listParam );
|
||||||
dumpValue( props, "setParam", setParam );
|
dumpValue( props, "setParam", setParam );
|
||||||
dumpValue( props, "mapParam", mapParam );
|
dumpValue( props, "mapParam", mapParam );
|
||||||
|
|
|
@ -63,12 +63,20 @@ public class EvalMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The project's base directory, used for manual path translation.
|
||||||
|
*
|
||||||
|
* @parameter default-value="${basedir}"
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
private File basedir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path to the output file for the properties with the expression values. For each expression given by the
|
* The path to the output file for the properties with the expression values. For each expression given by the
|
||||||
* parameter {@link #expressions} an similar named properties key will be used to save the expression value. If an
|
* parameter {@link #expressions} an similar named properties key will be used to save the expression value. If an
|
||||||
* expression evaluated to <code>null</code>, there will be no corresponding key in the properties file.
|
* expression evaluated to <code>null</code>, there will be no corresponding key in the properties file.
|
||||||
*
|
*
|
||||||
* @parameter expression="${expression.outputFile}" default-value="${project.build.directory}/expression.properties"
|
* @parameter expression="${expression.outputFile}"
|
||||||
*/
|
*/
|
||||||
private File outputFile;
|
private File outputFile;
|
||||||
|
|
||||||
|
@ -132,6 +140,14 @@ public class EvalMojo
|
||||||
throw new MojoFailureException( "Path name for output file has not been specified" );
|
throw new MojoFailureException( "Path name for output file has not been specified" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: We don't want to test path translation here.
|
||||||
|
*/
|
||||||
|
if ( !outputFile.isAbsolute() )
|
||||||
|
{
|
||||||
|
outputFile = new File( basedir, outputFile.getPath() ).getAbsoluteFile();
|
||||||
|
}
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile );
|
||||||
|
|
||||||
Properties expressionProperties = new Properties();
|
Properties expressionProperties = new Properties();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public abstract class AbstractLogMojo
|
||||||
/**
|
/**
|
||||||
* The path to the output file, relative to the current working directory.
|
* The path to the output file, relative to the current working directory.
|
||||||
*
|
*
|
||||||
* @parameter expression="${log.logFile}" default-value="target/it.log" alias="outputFile"
|
* @parameter expression="${log.logFile}"
|
||||||
*/
|
*/
|
||||||
private File logFile;
|
private File logFile;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue