mirror of https://github.com/apache/maven.git
[MNG-3920] add integration test for uses of plexus-component-api in plugins
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@738752 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04ec46ed76
commit
6921cebb9c
|
@ -0,0 +1,55 @@
|
|||
package org.apache.maven.it;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.it.util.FileUtils;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3920">MNG-3920</a>. The first test verifies that
|
||||
* a plugin using plexus-component-api in a Plexus component does not cause linkage errors.
|
||||
*/
|
||||
public class MavenITmng3920PlexusComponentApiTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenITmng3920PlexusComponentApiTest()
|
||||
{
|
||||
super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.11+, and not in 2.1.0-M1
|
||||
}
|
||||
|
||||
public void testitMNG3920()
|
||||
throws Exception
|
||||
{
|
||||
File dir =
|
||||
ResourceExtractor.simpleExtractResources( getClass(), "/mng-3920" );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = new Verifier( dir.getAbsolutePath() );
|
||||
|
||||
verifier.executeGoal( "validate" );
|
||||
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
verifier.resetStreams();
|
||||
}
|
||||
}
|
|
@ -183,6 +183,12 @@ under the License.
|
|||
<version>${itPluginVersion}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-plexus-component-api</artifactId>
|
||||
<version>${itPluginVersion}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-project-interpolation</artifactId>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<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>org.apache.maven.its.mng3920</groupId>
|
||||
<artifactId>child</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-plexus-component-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>velocity</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,55 @@
|
|||
<?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>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-it-plugins</artifactId>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-it-plugin-plexus-component-api</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven Integration Test Plugin :: Plexus Component API</name>
|
||||
|
||||
<dependencies>
|
||||
<!-- introduces component-api, should be excluded -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-velocity</artifactId>
|
||||
<version>1.1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,56 @@
|
|||
package org.apache.maven.its.plugins;
|
||||
|
||||
/*
|
||||
* 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.plugin.MojoFailureException;
|
||||
import org.codehaus.plexus.velocity.VelocityComponent;
|
||||
|
||||
/**
|
||||
* @goal velocity
|
||||
* @phase validate
|
||||
*/
|
||||
public class VelocityMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* @component
|
||||
*/
|
||||
protected VelocityComponent velocityComponent;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
// velocityComponent should not be null
|
||||
velocityComponent.getEngine();
|
||||
|
||||
try
|
||||
{
|
||||
// velocityComponent engine should not be null
|
||||
// this is the real test to check that we got the right Initializable interface in both Plexus and the component
|
||||
velocityComponent.getEngine().getTemplate( "/template.vm" );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new MojoExecutionException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Hello, World!
|
|
@ -57,6 +57,7 @@ under the License.
|
|||
<module>maven-it-plugin-all</module>
|
||||
<module>maven-it-plugin-plexus-utils-11</module>
|
||||
<module>maven-it-plugin-plexus-utils-new</module>
|
||||
<module>maven-it-plugin-plexus-component-api</module>
|
||||
</modules>
|
||||
|
||||
<scm>
|
||||
|
|
Loading…
Reference in New Issue