[MPLUGIN-260] added IT for JDK 8
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1592249 13f79535-47bb-0310-9956-ffa450edef68master
parent
c6e68e8d48
commit
32a8740e72
|
|
@ -0,0 +1,21 @@
|
|||
# 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.
|
||||
|
||||
invoker.java.version = 1.8+
|
||||
invoker.goals.1 = clean install -DskipTests
|
||||
invoker.goals.2 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0-SNAPSHOT:it0014
|
||||
invoker.goals.3 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0-SNAPSHOT:help
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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 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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its.basic-java-annotations</groupId>
|
||||
<artifactId>maven-it-basic-java-annotations</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Integration Test :: basic-java-annotations-jdk8</name>
|
||||
<description>
|
||||
Test plugin-plugin, which tests maven-plugin-tools-api and
|
||||
maven-plugin-tools-java. This will generate a plugin descriptor from
|
||||
java-based mojo sources, install the plugin, and then use it.
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-annotations</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<configuration>
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>mojo-descriptor</id>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>help-goal</id>
|
||||
<goals>
|
||||
<goal>helpmojo</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Touches a test file.
|
||||
*
|
||||
*/
|
||||
@Mojo( name = "it0014" )
|
||||
public class CoreIt0014Mojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
@Parameter( property = "project.build.directory", required = true )
|
||||
private String outputDirectory;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
getLog().info( "outputDirectory = " + outputDirectory );
|
||||
|
||||
File f = new File( outputDirectory );
|
||||
|
||||
if ( !f.exists() )
|
||||
{
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
File touch = new File( f, "touch.txt" );
|
||||
|
||||
try
|
||||
{
|
||||
touch.createNewFile();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error writing verification file.", e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.apache.maven.plugins.annotations.Execute;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.MavenProjectHelper;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Touches a test file.
|
||||
*
|
||||
* @since 1.2
|
||||
* @deprecated Don't use!
|
||||
*/
|
||||
@Mojo( name = "first", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
||||
public class FirstMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* Project directory.
|
||||
*/
|
||||
@Parameter( defaultValue = "${basedir}", readonly = true )
|
||||
private File basedir;
|
||||
|
||||
@Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt",
|
||||
required = true )
|
||||
private File touchFile;
|
||||
|
||||
/**
|
||||
* @since 0.1
|
||||
* @deprecated As of 0.2
|
||||
*/
|
||||
@Parameter( name = "namedParam", alias = "alias" )
|
||||
private String aliasedParam;
|
||||
|
||||
@Component( role = MavenProjectHelper.class, hint = "test" )
|
||||
private Object projectHelper;
|
||||
|
||||
@Component
|
||||
private MavenSession session;
|
||||
|
||||
@Component
|
||||
private MavenProject project;
|
||||
|
||||
@Component
|
||||
private MojoExecution mojo;
|
||||
|
||||
@Component
|
||||
private PluginDescriptor plugin;
|
||||
|
||||
@Component
|
||||
private Settings settings;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Could not use regex in @Parameter(defaultValue)
|
||||
*/
|
||||
@Mojo( name = "mplugin-220" )
|
||||
public class MPlugin220Mojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
@Parameter( defaultValue = "[a-zA-Z]{2,}-\\\\d+" )
|
||||
private String regex;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
getLog().info( "regex = " + regex );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.apache.maven.plugins.annotations.Execute;
|
||||
import org.apache.maven.plugins.annotations.InstantiationStrategy;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProjectHelper;
|
||||
|
||||
/**
|
||||
* Checks maximum annotations with non-default values.
|
||||
*
|
||||
* @since since-text
|
||||
* @deprecated deprecated-text
|
||||
*/
|
||||
@Mojo( name = "maximal",
|
||||
aggregator = true,
|
||||
configurator = "configurator-hint",
|
||||
requiresDependencyResolution = ResolutionScope.COMPILE,
|
||||
requiresDependencyCollection = ResolutionScope.TEST,
|
||||
defaultPhase = LifecyclePhase.PACKAGE,
|
||||
executionStrategy = "always",
|
||||
instantiationStrategy = InstantiationStrategy.SINGLETON,
|
||||
inheritByDefault = false,
|
||||
requiresDirectInvocation = true,
|
||||
requiresOnline = true,
|
||||
requiresProject = false,
|
||||
requiresReports = true,
|
||||
threadSafe = true )
|
||||
@Execute( phase = LifecyclePhase.COMPILE )
|
||||
public class Maximal
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* Parameter description.
|
||||
*
|
||||
* @since since-text
|
||||
* @deprecated deprecated-text
|
||||
*/
|
||||
@Parameter( alias = "myAlias",
|
||||
property = "aProperty",
|
||||
defaultValue = "${anExpression}",
|
||||
readonly = true,
|
||||
required = true )
|
||||
private String param;
|
||||
|
||||
@Component( role = MavenProjectHelper.class, hint = "test" )
|
||||
private Object projectHelper;
|
||||
|
||||
public void execute()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProjectHelper;
|
||||
|
||||
// minimum annotations => default values
|
||||
@Mojo( name = "minimal" )
|
||||
public class Minimal
|
||||
extends AbstractMojo
|
||||
{
|
||||
@Parameter
|
||||
private String param;
|
||||
|
||||
@Component
|
||||
private MavenProjectHelper projectHelper;
|
||||
|
||||
public void execute()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
File touchFile = new File( basedir, "target/touch.txt" )
|
||||
assert touchFile.isFile()
|
||||
|
||||
File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" );
|
||||
assert descriptorFile.isFile()
|
||||
|
||||
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
||||
|
||||
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
|
||||
|
||||
assert mojo.goal.text() == 'first'
|
||||
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
||||
assert mojo.language.text() == 'java'
|
||||
assert mojo.description.text() == 'Touches a test file.'
|
||||
assert mojo.deprecated.text() == "Don't use!"
|
||||
assert mojo.requiresDependencyResolution.text() == 'test'
|
||||
assert mojo.requiresDependencyCollection.text() == ''
|
||||
assert mojo.requiresProject.text() == 'true'
|
||||
assert mojo.requiresOnline.text() == 'false'
|
||||
assert mojo.requiresDirectInvocation.text() == 'false'
|
||||
assert mojo.aggregator.text() == 'false'
|
||||
assert mojo.threadSafe.text() == 'false'
|
||||
assert mojo.phase.text() == 'integration-test'
|
||||
assert mojo.executePhase.text() == 'generate-sources'
|
||||
assert mojo.executeLifecycle.text() == 'cobertura'
|
||||
|
||||
assert mojo.configuration.basedir[0].text() == ''
|
||||
assert mojo.configuration.basedir[0].'@implementation' == 'java.io.File'
|
||||
assert mojo.configuration.basedir[0].'@default-value' == '${basedir}'
|
||||
|
||||
assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
|
||||
assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
|
||||
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'
|
||||
|
||||
assert mojo.configuration.session[0].text() == ''
|
||||
assert mojo.configuration.session[0].'@implementation' == 'org.apache.maven.execution.MavenSession'
|
||||
assert mojo.configuration.session[0].'@default-value' == '${session}'
|
||||
|
||||
assert mojo.configuration.project[0].text() == ''
|
||||
assert mojo.configuration.project[0].'@implementation' == 'org.apache.maven.project.MavenProject'
|
||||
assert mojo.configuration.project[0].'@default-value' == '${project}'
|
||||
|
||||
assert mojo.configuration.mojo[0].text() == ''
|
||||
assert mojo.configuration.mojo[0].'@implementation' == 'org.apache.maven.plugin.MojoExecution'
|
||||
assert mojo.configuration.mojo[0].'@default-value' == '${mojoExecution}'
|
||||
|
||||
assert mojo.configuration.plugin[0].text() == ''
|
||||
assert mojo.configuration.plugin[0].'@implementation' == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
|
||||
assert mojo.configuration.plugin[0].'@default-value' == '${plugin}'
|
||||
|
||||
assert mojo.configuration.settings[0].text() == ''
|
||||
assert mojo.configuration.settings[0].'@implementation' == 'org.apache.maven.settings.Settings'
|
||||
assert mojo.configuration.settings[0].'@default-value' == '${settings}'
|
||||
|
||||
assert mojo.requirements.requirement.size() == 1
|
||||
|
||||
assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
|
||||
assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
|
||||
assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
|
||||
|
||||
assert mojo.parameters.parameter.size() == 8
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0]
|
||||
assert parameter.name.text() == 'namedParam'
|
||||
assert parameter.alias.text() == 'alias'
|
||||
assert parameter.type.text() == 'java.lang.String'
|
||||
assert parameter.deprecated.text() == 'As of 0.2'
|
||||
assert parameter.required.text() == 'false'
|
||||
assert parameter.editable.text() == 'true'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir" }[0]
|
||||
assert parameter.name.text() == 'basedir'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'java.io.File'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'false'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == 'Project directory.'
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0]
|
||||
assert parameter.name.text() == 'mojo'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'org.apache.maven.plugin.MojoExecution'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "plugin" }[0]
|
||||
assert parameter.name.text() == 'plugin'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'org.apache.maven.plugin.descriptor.PluginDescriptor'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "project" }[0]
|
||||
assert parameter.name.text() == 'project'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'org.apache.maven.project.MavenProject'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "session" }[0]
|
||||
assert parameter.name.text() == 'session'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'org.apache.maven.execution.MavenSession'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "settings" }[0]
|
||||
assert parameter.name.text() == 'settings'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'org.apache.maven.settings.Settings'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
|
||||
assert parameter.name.text() == 'touchFile'
|
||||
assert parameter.alias.isEmpty()
|
||||
assert parameter.type.text() == 'java.io.File'
|
||||
assert parameter.deprecated.isEmpty()
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'true'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
// check default values
|
||||
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "minimal"}[0]
|
||||
|
||||
assert mojo.goal.text() == 'minimal'
|
||||
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.Minimal'
|
||||
assert mojo.language.text() == 'java'
|
||||
assert mojo.description.text() == ''
|
||||
assert mojo.deprecated.text() == ''
|
||||
assert mojo.requiresDependencyResolution.text() == ''
|
||||
assert mojo.requiresDependencyCollection.text() == ''
|
||||
assert mojo.requiresProject.text() == 'true'
|
||||
assert mojo.requiresOnline.text() == 'false'
|
||||
assert mojo.requiresDirectInvocation.text() == 'false'
|
||||
assert mojo.requiresReports.text() == 'false'
|
||||
assert mojo.aggregator.text() == 'false'
|
||||
assert mojo.threadSafe.text() == 'false'
|
||||
assert mojo.phase.text() == ''
|
||||
assert mojo.executePhase.text() == ''
|
||||
assert mojo.executeLifecycle.text() == ''
|
||||
assert mojo.executionStrategy.text() == 'once-per-session'
|
||||
assert mojo.inheritedByDefault.text() == 'true'
|
||||
assert mojo.instantiationStrategy.text() == 'per-lookup'
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "param" }[0]
|
||||
assert parameter.name.text() == 'param'
|
||||
assert parameter.alias.text() == ''
|
||||
assert parameter.type.text() == 'java.lang.String'
|
||||
assert parameter.deprecated.text() == ''
|
||||
assert parameter.required.text() == 'false'
|
||||
assert parameter.editable.text() == 'true'
|
||||
assert parameter.description.text() == ''
|
||||
|
||||
def requirement = mojo.requirements.requirement.findAll{ it.'field-name'.text() == "projectHelper" }[0]
|
||||
assert requirement.role.text() == 'org.apache.maven.project.MavenProjectHelper'
|
||||
|
||||
// check values set by every annotation
|
||||
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "maximal"}[0]
|
||||
|
||||
assert mojo.goal.text() == 'maximal'
|
||||
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.Maximal'
|
||||
assert mojo.language.text() == 'java'
|
||||
assert mojo.description.text() == 'Checks maximum annotations with non-default values.'
|
||||
assert mojo.deprecated.text() == 'deprecated-text'
|
||||
assert mojo.requiresDependencyResolution.text() == 'compile'
|
||||
assert mojo.requiresDependencyCollection.text() == 'test'
|
||||
assert mojo.requiresProject.text() == 'false'
|
||||
assert mojo.requiresOnline.text() == 'true'
|
||||
assert mojo.requiresDirectInvocation.text() == 'true'
|
||||
assert mojo.requiresReports.text() == 'true'
|
||||
assert mojo.aggregator.text() == 'true'
|
||||
assert mojo.configurator.text() == 'configurator-hint'
|
||||
assert mojo.threadSafe.text() == 'true'
|
||||
assert mojo.phase.text() == 'package'
|
||||
assert mojo.executePhase.text() == 'compile'
|
||||
assert mojo.executeLifecycle.text() == ''
|
||||
assert mojo.executionStrategy.text() == 'always'
|
||||
assert mojo.inheritedByDefault.text() == 'false'
|
||||
assert mojo.instantiationStrategy.text() == 'singleton'
|
||||
|
||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "param" }[0]
|
||||
assert parameter.name.text() == 'param'
|
||||
assert parameter.alias.text() == 'myAlias'
|
||||
assert parameter.type.text() == 'java.lang.String'
|
||||
assert parameter.since.text() == 'since-text'
|
||||
assert parameter.deprecated.text() == 'deprecated-text'
|
||||
assert parameter.required.text() == 'true'
|
||||
assert parameter.editable.text() == 'false'
|
||||
assert parameter.description.text() == 'Parameter description.'
|
||||
|
||||
requirement = mojo.requirements.requirement.findAll{ it.'field-name'.text() == "projectHelper" }[0]
|
||||
assert requirement.role.text() == 'org.apache.maven.project.MavenProjectHelper'
|
||||
|
||||
// check help mojo source and class
|
||||
assert new File( basedir, "target/classes/org/apache/maven/plugin/coreit/HelpMojo.class" ).isFile()
|
||||
assert new File( basedir, "target/generated-sources/plugin/org/apache/maven/plugin/coreit/HelpMojo.java" ).isFile()
|
||||
assert !new File( basedir, "target/generated-sources/plugin/HelpMojo.java" ).isFile()
|
||||
|
||||
return true;
|
||||
Loading…
Reference in New Issue