mirror of https://github.com/apache/maven.git
[MNG-8299] IT for custom lifecycle phase ordering (#389)
Main PR: https://github.com/apache/maven/pull/1802 --- https://issues.apache.org/jira/browse/MNG-8299
This commit is contained in:
parent
d98fe8e9f0
commit
eff246a5bf
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.maven.it;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.maven.shared.verifier.Verifier;
|
||||
import org.apache.maven.shared.verifier.util.ResourceExtractor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-8299">MNG-8299</a>.
|
||||
*/
|
||||
class MavenITmng8299CustomLifecycleTest extends AbstractMavenIntegrationTestCase {
|
||||
|
||||
MavenITmng8299CustomLifecycleTest() {
|
||||
super("[2.0,4.0.0-alpha-13],[4.0.0-beta-5,)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that invoking the third phase will invoke the first two
|
||||
*/
|
||||
@Test
|
||||
void testPhaseOrdering() throws Exception {
|
||||
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8299-custom-lifecycle");
|
||||
|
||||
Verifier verifier = newVerifier(new File(testDir, "CustomLifecyclePlugin").getAbsolutePath());
|
||||
verifier.addCliArgument("install");
|
||||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
verifier = newVerifier(new File(testDir, "CustomLifecycleProject").getAbsolutePath());
|
||||
verifier.addCliArgument("phase3");
|
||||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.verifyTextInLog("[INFO] Doing Phase 1 stuff. Oh yeah baby.");
|
||||
}
|
||||
}
|
|
@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer {
|
|||
* the tests are to finishing. Newer tests are also more likely to fail, so this is
|
||||
* a fail fast technique as well.
|
||||
*/
|
||||
suite.addTestSuite(MavenITmng8299CustomLifecycleTest.class);
|
||||
suite.addTestSuite(MavenITmng7982DependencyManagementTransitivityTest.class);
|
||||
suite.addTestSuite(MavenITmng8294ParentChecksTest.class);
|
||||
suite.addTestSuite(MavenITmng8293BomImportFromReactor.class);
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>com.nextmetaphor.plugin</groupId>
|
||||
<artifactId>CustomLifecyclePlugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Custom Lifecycle Plugin</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<goalPrefix>CustomLifecyclePlugin</goalPrefix>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.nextmetaphor.plugin.mojo;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
/**
|
||||
* Forks a zip lifecycle.
|
||||
* @goal phase1Goal
|
||||
*/
|
||||
public class CustomLifecyclePluginPhase1Mojo extends AbstractMojo {
|
||||
public void execute() throws MojoExecutionException {
|
||||
getLog().info("Doing Phase 1 stuff. Oh yeah baby.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.Lifecycle</role>
|
||||
<role-hint>customLifecyclePlugin_PackagingType</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
|
||||
<configuration>
|
||||
<id>customLifecyclePlugin_LifecycleID</id>
|
||||
<phases>
|
||||
<phase>phase1</phase>
|
||||
<phase>phase2</phase>
|
||||
<phase>phase3</phase>
|
||||
</phases>
|
||||
<default-phases>
|
||||
<phase1>com.nextmetaphor.plugin:CustomLifecyclePlugin:phase1Goal</phase1>
|
||||
</default-phases>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>com.nextmetaphor.project</groupId>
|
||||
<artifactId>CustomLifecycleProject</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Custom Lifecycle Project</name>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.nextmetaphor.plugin</groupId>
|
||||
<artifactId>CustomLifecyclePlugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue