mirror of https://github.com/apache/maven.git
MNG-5805: Custom packaging types: configuring DefaultLifecycleMapping mojo executions
Signed-off-by: Jason van Zyl <jason@tesla.io>
This commit is contained in:
parent
6d9ffe47e1
commit
2e478d0de3
|
@ -106,6 +106,7 @@ public class IntegrationTestSuite
|
|||
// -------------------------------------------------------------------------------------------------------------
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
|
||||
suite.addTestSuite( MavenITmng5805PkgTypeMojoConfiguration.class );
|
||||
suite.addTestSuite( MavenITmng5783PluginDependencyFiltering.class );
|
||||
suite.addTestSuite( MavenITmng5774ConfigurationProcessorsTest.class );
|
||||
suite.addTestSuite( MavenITmng5771CoreExtensionsTest.class );
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.apache.maven.it;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
public class MavenITmng5805PkgTypeMojoConfiguration
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng5805PkgTypeMojoConfiguration()
|
||||
{
|
||||
super( "(3.3.2,)" );
|
||||
}
|
||||
|
||||
public void testPkgTypeMojoConfiguration()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5805-pkg-type-mojo-configuration" );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = newVerifier( new File( testDir, "extension" ).getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = newVerifier( new File( testDir, "plugin" ).getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = newVerifier( new File( testDir, "plugin-dep" ).getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = newVerifier( new File( testDir, "project" ).getAbsolutePath() );
|
||||
verifier.executeGoal( "validate" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?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>mng-5805-pkg-type-mojo-configuration</groupId>
|
||||
<artifactId>mng-5805-pkg-type-mojo-configuration-extension</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
</project>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component-set>
|
||||
<components>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>mng5805</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<phases>
|
||||
<validate>
|
||||
<mojos>
|
||||
<mojo>
|
||||
<goal>
|
||||
mng-5805-pkg-type-mojo-configuration:mng-5805-pkg-type-mojo-configuration-plugin:0.1:test
|
||||
</goal>
|
||||
<configuration>
|
||||
<className>org.apache.maven.its.mng5805.TestClass1</className>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.mng5805</groupId>
|
||||
<artifactId>plugin-dep</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</mojo>
|
||||
</mojos>
|
||||
</validate>
|
||||
</phases>
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
|
||||
<role-hint>mng5805</role-hint>
|
||||
<implementation>
|
||||
org.apache.maven.artifact.handler.DefaultArtifactHandler
|
||||
</implementation>
|
||||
<configuration>
|
||||
<extension>zip</extension>
|
||||
<type>mng5805</type>
|
||||
<packaging>mng5805</packaging>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
</components>
|
||||
</component-set>
|
|
@ -0,0 +1,30 @@
|
|||
<?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.mng5805</groupId>
|
||||
<artifactId>plugin-dep</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,5 @@
|
|||
package org.apache.maven.its.mng5805;
|
||||
|
||||
public class TestClass1 {
|
||||
|
||||
}
|
|
@ -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 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>mng-5805-pkg-type-mojo-configuration</groupId>
|
||||
<artifactId>mng-5805-pkg-type-mojo-configuration-plugin</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<maven-version>3.3.1</maven-version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${maven-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>${maven-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>${maven-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,51 @@
|
|||
package org.apache.maven.its.mng5805.plugin;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* @parameter default-value="org.apache.maven.its.mng5805.DoesNotExist"
|
||||
*/
|
||||
private String className;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
|
||||
getLog().info( "CLASS_NAME=" + className );
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( className );
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
throw new MojoExecutionException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?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>mng-5805-pkg-type-mojo-configuration</groupId>
|
||||
<artifactId>mng-5805-pkg-type-mojo-configuration-project</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>mng5805</packaging>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>mng-5805-pkg-type-mojo-configuration</groupId>
|
||||
<artifactId>mng-5805-pkg-type-mojo-configuration-extension</artifactId>
|
||||
<version>0.1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue