mirror of https://github.com/apache/maven.git
Revert "MNG-6209 better executeMojo thread context classloader"
This reverts commit a3e6d5c35e
.
This commit is contained in:
parent
9c19ac8f5a
commit
47321c64de
|
@ -700,7 +700,6 @@ public class IntegrationTestSuite
|
|||
suite.addTestSuite( MavenIT0010DependencyClosureResolutionTest.class );
|
||||
suite.addTestSuite( MavenIT0009GoalConfigurationTest.class );
|
||||
suite.addTestSuite( MavenIT0008SimplePluginTest.class );
|
||||
suite.addTestSuite( MavenITmng6209MultipleBuildExtensions.class );
|
||||
suite.addTestSuite( MavenITmng6210CoreExtensionsCustomScopesTest.class );
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
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.ResourceExtractor;
|
||||
import org.apache.maven.shared.utils.io.FileUtils;
|
||||
|
||||
public class MavenITmng6209MultipleBuildExtensions extends AbstractMavenIntegrationTestCase {
|
||||
|
||||
public MavenITmng6209MultipleBuildExtensions() {
|
||||
super("(3.5.0,)");
|
||||
}
|
||||
|
||||
public void testBuildExtensionClassloader() throws Exception {
|
||||
File testDir =
|
||||
ResourceExtractor.simpleExtractResources(getClass(), "/mng-6209-multiple-build-extensions");
|
||||
File pluginADir = new File(testDir, "plugin-a");
|
||||
File pluginBDir = new File(testDir, "plugin-b");
|
||||
File projectDir = new File(testDir, "project");
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
// install the test plugins
|
||||
verifier = newVerifier(pluginADir.getAbsolutePath(), "remote");
|
||||
verifier.executeGoal("install");
|
||||
verifier.resetStreams();
|
||||
verifier.verifyErrorFreeLog();
|
||||
//
|
||||
verifier = newVerifier(pluginBDir.getAbsolutePath(), "remote");
|
||||
verifier.executeGoal("install");
|
||||
verifier.resetStreams();
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
// build the test project
|
||||
verifier = newVerifier(projectDir.getAbsolutePath(), "remote");
|
||||
verifier.executeGoal("validate");
|
||||
verifier.resetStreams();
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.assertFilePresent("target/executions.txt");
|
||||
|
||||
String[] executions = FileUtils.fileReadArray(new File(projectDir, "target/executions.txt"));
|
||||
assertEquals(2, executions.length);
|
||||
assertEquals(
|
||||
"mng-6209-multiple-build-extensions:mng-6209-multiple-build-extensions-plugin-a:0.1:test {execution: test}",
|
||||
executions[0]);
|
||||
assertEquals(
|
||||
"mng-6209-multiple-build-extensions:mng-6209-multiple-build-extensions-plugin-b:0.1:test {execution: test}",
|
||||
executions[1]);
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>mng-6209-multiple-build-extensions</groupId>
|
||||
<artifactId>mng-6209-multiple-build-extensions-plugin-a</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<maven-version>3.2.1</maven-version>
|
||||
<maven.compiler.source>1.5</maven.compiler.source>
|
||||
<maven.compiler.target>1.5</maven.compiler.target>
|
||||
</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>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>sisu-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>main-index</goal>
|
||||
<goal>test-index</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,88 +0,0 @@
|
|||
package org.apache.maven.its.mng6209.multiple.build.extensions.plugina;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/*
|
||||
* 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 javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.AbstractMavenLifecycleParticipant;
|
||||
import org.apache.maven.MavenExecutionException;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.execution.MojoExecutionEvent;
|
||||
import org.apache.maven.execution.MojoExecutionListener;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
@Named
|
||||
@Singleton
|
||||
public class BuildExtensionAComponent
|
||||
extends AbstractMavenLifecycleParticipant
|
||||
implements MojoExecutionListener
|
||||
{
|
||||
public static final String FILE_PATH = "target/executions.txt";
|
||||
|
||||
private final Set<String> executions = new TreeSet<String>();
|
||||
|
||||
@Override
|
||||
public void afterSessionEnd( MavenSession session )
|
||||
throws MavenExecutionException
|
||||
{
|
||||
try
|
||||
{
|
||||
File file = new File( session.getTopLevelProject().getBasedir(), FILE_PATH );
|
||||
file.getParentFile().mkdirs();
|
||||
Writer w = new OutputStreamWriter( new FileOutputStream( file, false ), "UTF-8" );
|
||||
try
|
||||
{
|
||||
for (String execution : executions)
|
||||
{
|
||||
w.write( execution + "\n" );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void beforeMojoExecution( MojoExecutionEvent event )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
executions.add( event.getExecution().toString() );
|
||||
}
|
||||
|
||||
public void afterMojoExecutionSuccess( MojoExecutionEvent event )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
}
|
||||
|
||||
public void afterExecutionFailure( MojoExecutionEvent event )
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package org.apache.maven.its.mng6209.multiple.build.extensions.plugina;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class BuildExtensionAMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>mng-6209-multiple-build-extensions</groupId>
|
||||
<artifactId>mng-6209-multiple-build-extensions-plugin-b</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
<maven-version>3.2.1</maven-version>
|
||||
<maven.compiler.source>1.5</maven.compiler.source>
|
||||
<maven.compiler.target>1.5</maven.compiler.target>
|
||||
</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>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>sisu-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>main-index</goal>
|
||||
<goal>test-index</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,36 +0,0 @@
|
|||
package org.apache.maven.its.mng6209.multiple.build.extensions.pluginb;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class BuildExtensionBMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>mng-6209-multiple-build-extensions</groupId>
|
||||
<artifactId>mng-6209-multiple-build-extensions-project</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>mng-6209-multiple-build-extensions</groupId>
|
||||
<artifactId>mng-6209-multiple-build-extensions-plugin-a</artifactId>
|
||||
<version>0.1</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>mng-6209-multiple-build-extensions</groupId>
|
||||
<artifactId>mng-6209-multiple-build-extensions-plugin-b</artifactId>
|
||||
<version>0.1</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue