This is an automated email from the ASF dual-hosted git repository. tibordigana pushed a commit to branch 3.0.0-M1 in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 0949403a36959e8b2b2a2f175b844421645a360a Author: Tibor17 <[email protected]> AuthorDate: Fri Oct 12 01:35:27 2018 +0200 [SUREFIRE-1493] Maven Plugin API 3.0 --- README.md | 2 +- maven-failsafe-plugin/pom.xml | 19 +-- .../apache/maven/plugin/failsafe/VerifyMojo.java | 2 +- maven-surefire-common/pom.xml | 76 +++------- .../plugin/surefire/AbstractSurefireMojo.java | 161 ++++----------------- .../apache/maven/plugin/surefire/ProviderInfo.java | 4 +- .../surefire/SurefireDependencyResolver.java | 78 +++++----- .../maven/plugin/surefire/SurefireHelper.java | 44 ++---- .../plugin/surefire/log/PluginConsoleLogger.java | 43 ++---- .../surefire/report/DefaultReporterFactory.java | 15 +- .../surefire/report/StatelessXmlReporter.java | 21 ++- .../plugin/surefire/report/TestSetRunListener.java | 2 +- .../plugin/surefire/AbstractSurefireMojoTest.java | 1 - maven-surefire-plugin/pom.xml | 7 +- maven-surefire-plugin/src/site/apt/index.apt.vm | 2 +- maven-surefire-report-plugin/pom.xml | 70 ++++++--- .../surefire/report/PluginConsoleLogger.java | 43 ++---- pom.xml | 133 ++++------------- surefire-api/pom.xml | 4 +- surefire-booter/pom.xml | 6 +- surefire-grouper/pom.xml | 2 +- .../src/test/resources/SurefireToolchains/pom.xml | 2 +- .../resources/test-helper-dump-pid-plugin/pom.xml | 2 +- .../test/java/listeners/MarkAsFailureListener.java | 18 +-- surefire-providers/common-java5/pom.xml | 10 +- surefire-providers/common-junit4/pom.xml | 31 +++- surefire-providers/common-junit48/pom.xml | 38 +---- surefire-providers/pom.xml | 1 + surefire-providers/surefire-junit-platform/pom.xml | 37 +---- surefire-providers/surefire-junit3/pom.xml | 31 ---- surefire-providers/surefire-junit4/pom.xml | 42 ------ surefire-providers/surefire-junit47/pom.xml | 34 +---- surefire-providers/surefire-testng-utils/pom.xml | 31 +--- surefire-providers/surefire-testng/pom.xml | 6 - surefire-report-parser/pom.xml | 7 +- surefire-shadefire/pom.xml | 3 - 36 files changed, 310 insertions(+), 718 deletions(-) diff --git a/README.md b/README.md index 1fc5458..d8357c1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Usage of [maven-surefire-plugin], [maven-failsafe-plugin], [maven-surefire-repor # Build Status -[](https://builds.apache.org/job/maven-wip/job/maven-surefire/depgraph-view/) Maven 2.2.1 Plugin API +[](https://builds.apache.org/job/maven-wip/job/maven-surefire/depgraph-view/) Maven 3.0 Plugin API [](http://www.apache.org/licenses/LICENSE-2.0.html) [](https://builds.apache.org/job/maven-box/job/maven-surefire/job/master/lastBuild/testReport/) [](https://builds.apache.org/job/m [...] diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml index 19de66f..bbb8005 100644 --- a/maven-failsafe-plugin/pom.xml +++ b/maven-failsafe-plugin/pom.xml @@ -35,7 +35,7 @@ <description>Maven Failsafe MOJO in maven-failsafe-plugin.</description> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <properties> @@ -49,6 +49,7 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>maven-surefire-common</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> @@ -75,6 +76,10 @@ <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-artifact-transfer</artifactId> + </dependency> </dependencies> <build> @@ -170,7 +175,8 @@ </goals> <configuration> <target name="generate-failsafe-test-report"> - <move file="${project.build.directory}/source-site/resources/xsd/surefire-test-report.xsd" tofile="${project.build.directory}/source-site/resources/xsd/failsafe-test-report.xsd" /> + <move file="${project.build.directory}/source-site/resources/xsd/surefire-test-report.xsd" + tofile="${project.build.directory}/source-site/resources/xsd/failsafe-test-report.xsd"/> </target> </configuration> </execution> @@ -184,7 +190,6 @@ </configuration> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -257,15 +262,7 @@ </build> </profile> <profile> - <!-- run integration tests - to use this profile: - or run integration tests: mvn -Prun-its - --> <id>run-its</id> - <properties> - <!-- skip tests with -DskipTests --> - <skipTests>false</skipTests> - </properties> <build> <defaultGoal>verify</defaultGoal> <plugins> diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java index bbf47eb..dbb6b7e 100644 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java @@ -151,7 +151,7 @@ public class VerifyMojo /** * The current build session instance. */ - @Component + @Parameter( defaultValue = "${session}", readonly = true ) private MavenSession session; @Component diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml index 163b830..6314272 100644 --- a/maven-surefire-common/pom.xml +++ b/maven-surefire-common/pom.xml @@ -33,41 +33,35 @@ <description>API used in Surefire and Failsafe MOJO.</description> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <dependencies> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven.plugin-tools</groupId> - <artifactId>maven-plugin-annotations</artifactId> - </dependency> - <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-api</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-booter</artifactId> + <version>${project.version}</version> </dependency> <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-shared-utils</artifactId> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> </dependency> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> </dependency> <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-descriptor</artifactId> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-artifact</artifactId> </dependency> <dependency> <groupId>commons-io</groupId> @@ -97,6 +91,12 @@ <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-common-artifact-filters</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-plugin-testing-harness</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.fusesource.jansi</groupId> @@ -142,43 +142,6 @@ <build> <plugins> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${project.build.directory}/generated-sources</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <!-- Remove in 3.0 --> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>shared-logging-generated-sources</id> - <phase>generate-sources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> - <overWriteIfNewer>false</overWriteIfNewer> - <artifact>org.apache.maven.shared:maven-shared-utils:3.1.0:jar:sources</artifact> - <includes>org/apache/maven/shared/utils/logging/*.java</includes> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <includes> @@ -194,7 +157,6 @@ </dependencies> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -215,15 +177,15 @@ <relocations> <relocation> <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.common.org.apache.maven.shared</shadedPattern> </relocation> <relocation> <pattern>org.apache.commons.io</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.commons.io</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.common.org.apache.commons.io</shadedPattern> </relocation> <relocation> <pattern>org.apache.commons.lang3</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.commons.lang3</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.common.org.apache.commons.lang3</shadedPattern> </relocation> </relocations> </configuration> diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index c976a23..b8f759a 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -22,15 +22,11 @@ package org.apache.maven.plugin.surefire; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.repository.RepositorySystem; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; @@ -53,7 +49,6 @@ import org.apache.maven.plugin.surefire.log.PluginConsoleLogger; import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; import org.apache.maven.plugin.surefire.util.DependencyScanner; import org.apache.maven.plugin.surefire.util.DirectoryScanner; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter; @@ -95,7 +90,6 @@ import javax.annotation.Nonnull; import java.io.File; import java.io.IOException; import java.lang.reflect.Array; -import java.lang.reflect.Method; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; @@ -199,7 +193,7 @@ public abstract class AbstractSurefireMojo /** * The Maven Project Object. */ - @Component + @Parameter( defaultValue = "${project}", required = true, readonly = true ) private MavenProject project; /** @@ -330,14 +324,12 @@ public abstract class AbstractSurefireMojo /** * Map of plugin artifacts. */ - // olamy: would make more sense using defaultValue but doesn't work with maven 2.x @Parameter( property = "plugin.artifactMap", required = true, readonly = true ) private Map<String, Artifact> pluginArtifactMap; /** * Map of project artifacts. */ - // olamy: would make more sense using defaultValue but doesn't work with maven 2.x @Parameter( property = "project.artifactMap", readonly = true, required = true ) private Map<String, Artifact> projectArtifactMap; @@ -667,12 +659,6 @@ public abstract class AbstractSurefireMojo private boolean trimStackTrace; /** - * Resolves the artifacts needed. - */ - @Component - private ArtifactResolver artifactResolver; - - /** * Creates the artifact. */ @Component @@ -687,12 +673,6 @@ public abstract class AbstractSurefireMojo private List<ArtifactRepository> remoteRepositories; /** - * For retrieval of artifact's metadata. - */ - @Component - private ArtifactMetadataSource metadataSource; - - /** * Flag to disable the generation of report files in xml format. * * @since 2.2 @@ -712,7 +692,7 @@ public abstract class AbstractSurefireMojo /** * The current build session instance. */ - @Component + @Parameter( defaultValue = "${session}", required = true, readonly = true ) private MavenSession session; @Component @@ -727,7 +707,7 @@ public abstract class AbstractSurefireMojo private String objectFactory; /** - * + * Parallel Maven Execution. */ @Parameter( defaultValue = "${session.parallel}", readonly = true ) private Boolean parallelMavenExecution; @@ -754,9 +734,6 @@ public abstract class AbstractSurefireMojo @Parameter( property = "dependenciesToScan" ) private String[] dependenciesToScan; - /** - * - */ @Component private ToolchainManager toolchainManager; @@ -765,6 +742,9 @@ public abstract class AbstractSurefireMojo // @Component // private LocationManager locationManager; + @Component + private RepositorySystem repositorySystem; + private Artifact surefireBooterArtifact; private Toolchain toolchain; @@ -1043,9 +1023,9 @@ public abstract class AbstractSurefireMojo private void createDependencyResolver() { - dependencyResolver = new SurefireDependencyResolver( getArtifactResolver(), getArtifactFactory(), + dependencyResolver = new SurefireDependencyResolver( getRepositorySystem(), getArtifactFactory(), getConsoleLogger(), getLocalRepository(), - getRemoteRepositories(), getMetadataSource(), + getRemoteRepositories(), getPluginName() ); } @@ -1182,6 +1162,7 @@ public abstract class AbstractSurefireMojo return forkStarter.run( effectiveProperties, scanResult ); } + // tod Java 1.7 multiple exception catch block catch ( SurefireExecutionException e ) { forkStarter.killOrphanForks(); @@ -1238,6 +1219,16 @@ public abstract class AbstractSurefireMojo capitalizeFirstLetter( getPluginName() ) + " report directory: " + getReportsDirectory() ); } + public RepositorySystem getRepositorySystem() + { + return repositorySystem; + } + + public void setRepositorySystem( RepositorySystem repositorySystem ) + { + this.repositorySystem = repositorySystem; + } + final Toolchain getToolchain() { Toolchain tc = null; @@ -1730,10 +1721,6 @@ public abstract class AbstractSurefireMojo return newStartupConfigWithClasspath( classLoaderConfiguration, providerArtifacts, providerName ); } } - catch ( AbstractArtifactResolutionException e ) - { - throw new MojoExecutionException( "Unable to generate classpath: " + e, e ); - } catch ( IOException e ) { throw new MojoExecutionException( e.getMessage(), e ); @@ -2155,7 +2142,6 @@ public abstract class AbstractSurefireMojo Artifact shadeFire = getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-shadefire" ); - // todo: 150 milli seconds, try to fetch List<String> within classpath asynchronously Classpath bootClasspath = getArtifactClasspath( shadeFire != null ? shadeFire : surefireBooterArtifact ); Platform platform = PLATFORM.withJdkExecAttributesForTests( getEffectiveJvm() ); @@ -2522,32 +2508,9 @@ public abstract class AbstractSurefireMojo } } - - private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact ) + private ArtifactResolutionResult resolveArtifact( Artifact providerArtifact ) { - ArtifactFilter filter = null; - if ( filteredArtifact != null ) - { - filter = new ExcludesArtifactFilter( - Collections.singletonList( filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId() ) ); - } - - Artifact originatingArtifact = getArtifactFactory().createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); - - try - { - return getArtifactResolver().resolveTransitively( Collections.singleton( providerArtifact ), - originatingArtifact, getLocalRepository(), - getRemoteRepositories(), getMetadataSource(), filter ); - } - catch ( ArtifactResolutionException e ) - { - throw new RuntimeException( e ); - } - catch ( ArtifactNotFoundException e ) - { - throw new RuntimeException( e ); - } + return dependencyResolver.resolveArtifact( providerArtifact ); } private Classpath getArtifactClasspath( Artifact surefireArtifact ) @@ -2555,17 +2518,12 @@ public abstract class AbstractSurefireMojo Classpath existing = ClasspathCache.getCachedClassPath( surefireArtifact.getArtifactId() ); if ( existing == null ) { - ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact ); - List<String> items = new ArrayList<String>(); - for ( Object o : result.getArtifacts() ) + for ( Artifact artifact : resolveArtifact( surefireArtifact ).getArtifacts() ) { - Artifact artifact = (Artifact) o; - getConsoleLogger().debug( "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: " + artifact.getScope() ); - items.add( artifact.getFile().getAbsolutePath() ); } existing = new Classpath( items ); @@ -2576,34 +2534,9 @@ public abstract class AbstractSurefireMojo private Properties getUserProperties() { - Properties props = null; - try - { - // try calling MavenSession.getUserProperties() from Maven 2.1.0-M1+ - Method getUserProperties = getSession().getClass().getMethod( "getUserProperties" ); - props = (Properties) getUserProperties.invoke( getSession() ); - } - catch ( Exception e ) - { - String msg = "Build uses Maven 2.0.x, cannot propagate system properties" - + " from command line to tests (cf. SUREFIRE-121)"; - if ( getConsoleLogger().isDebugEnabled() ) - { - getConsoleLogger().debug( msg, e ); - } - else - { - getConsoleLogger().warning( msg ); - } - } - if ( props == null ) - { - props = new Properties(); - } - return props; + return getSession().getUserProperties(); } - private void ensureWorkingDirectoryExists() throws MojoFailureException { @@ -2811,11 +2744,10 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { Artifact surefireArtifact = getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-booter" ); String version = surefireArtifact.getBaseVersion(); - return dependencyResolver.getProviderClasspath( "surefire-testng", version, testNgArtifact ); + return dependencyResolver.getProviderClasspath( "surefire-testng", version ); } } @@ -2842,12 +2774,11 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { // add the JUnit provider as default - it doesn't require JUnit to be present, // since it supports POJO tests. String version = surefireBooterArtifact.getBaseVersion(); - return dependencyResolver.getProviderClasspath( "surefire-junit3", version, null ); + return dependencyResolver.getProviderClasspath( "surefire-junit3", version ); } } @@ -2884,10 +2815,9 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { String version = surefireBooterArtifact.getBaseVersion(); - return dependencyResolver.getProviderClasspath( "surefire-junit4", version, null ); + return dependencyResolver.getProviderClasspath( "surefire-junit4", version ); } } @@ -2923,10 +2853,9 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { String version = surefireBooterArtifact.getBaseVersion(); - return dependencyResolver.getProviderClasspath( "surefire-junit-platform", version, null ); + return dependencyResolver.getProviderClasspath( "surefire-junit-platform", version ); } } @@ -2972,10 +2901,9 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { String version = surefireBooterArtifact.getBaseVersion(); - return dependencyResolver.getProviderClasspath( "surefire-junit47", version, null ); + return dependencyResolver.getProviderClasspath( "surefire-junit47", version ); } } @@ -3022,7 +2950,6 @@ public abstract class AbstractSurefireMojo @Override @Nonnull public Set<Artifact> getProviderClasspath() - throws ArtifactResolutionException, ArtifactNotFoundException { return dependencyResolver.addProviderToClasspath( pluginArtifactMap, getMojoArtifact() ); } @@ -3504,17 +3431,6 @@ public abstract class AbstractSurefireMojo this.trimStackTrace = trimStackTrace; } - public ArtifactResolver getArtifactResolver() - { - return artifactResolver; - } - - @SuppressWarnings( "UnusedDeclaration" ) - public void setArtifactResolver( ArtifactResolver artifactResolver ) - { - this.artifactResolver = artifactResolver; - } - public ArtifactFactory getArtifactFactory() { return artifactFactory; @@ -3537,18 +3453,6 @@ public abstract class AbstractSurefireMojo this.remoteRepositories = remoteRepositories; } - public ArtifactMetadataSource getMetadataSource() - { - return metadataSource; - } - - @SuppressWarnings( "UnusedDeclaration" ) - public void setMetadataSource( ArtifactMetadataSource metadataSource ) - { - this.metadataSource = metadataSource; - } - - public boolean isDisableXmlReport() { return disableXmlReport; @@ -3633,11 +3537,6 @@ public abstract class AbstractSurefireMojo this.dependenciesToScan = dependenciesToScan; } - public PluginDescriptor getPluginDescriptor() - { - return pluginDescriptor; - } - public MavenProject getProject() { return project; diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java index e99cc82..cb63cc1 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java @@ -20,7 +20,6 @@ package org.apache.maven.plugin.surefire; */ import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException; import org.apache.maven.plugin.MojoExecutionException; import javax.annotation.Nonnull; @@ -37,8 +36,7 @@ public interface ProviderInfo boolean isApplicable(); @Nonnull - Set<Artifact> getProviderClasspath() - throws AbstractArtifactResolutionException; + Set<Artifact> getProviderClasspath(); void addProviderProperties() throws MojoExecutionException; } diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java index f33a316..fa3932c 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java @@ -19,31 +19,28 @@ package org.apache.maven.plugin.surefire; * under the License. */ +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; +import org.apache.maven.repository.RepositorySystem; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import static java.util.Collections.singleton; +import static java.util.Collections.singletonList; import static org.apache.maven.artifact.Artifact.SCOPE_TEST; import static org.apache.maven.artifact.versioning.VersionRange.createFromVersion; @@ -53,10 +50,9 @@ import static org.apache.maven.artifact.versioning.VersionRange.createFromVersio * @author Stephen Connolly * @author Kristian Rosenvold */ -public class SurefireDependencyResolver +final class SurefireDependencyResolver { - - private final ArtifactResolver artifactResolver; + private final RepositorySystem repositorySystem; private final ArtifactFactory artifactFactory; @@ -66,27 +62,21 @@ public class SurefireDependencyResolver private final List<ArtifactRepository> remoteRepositories; - private final ArtifactMetadataSource artifactMetadataSource; - private final String pluginName; - protected SurefireDependencyResolver( ArtifactResolver artifactResolver, ArtifactFactory artifactFactory, - ConsoleLogger log, + SurefireDependencyResolver( RepositorySystem repositorySystem, ArtifactFactory artifactFactory, ConsoleLogger log, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource artifactMetadataSource, String pluginName ) + List<ArtifactRepository> remoteRepositories, String pluginName ) { - this.artifactResolver = artifactResolver; + this.repositorySystem = repositorySystem; this.artifactFactory = artifactFactory; this.log = log; this.localRepository = localRepository; this.remoteRepositories = remoteRepositories; - this.artifactMetadataSource = artifactMetadataSource; this.pluginName = pluginName; } - - public boolean isWithinVersionSpec( @Nullable Artifact artifact, @Nonnull String versionSpec ) + boolean isWithinVersionSpec( @Nullable Artifact artifact, @Nonnull String versionSpec ) { if ( artifact == null ) { @@ -114,39 +104,38 @@ public class SurefireDependencyResolver } } + ArtifactResolutionResult resolveArtifact( Artifact providerArtifact ) + { + return resolveArtifact( providerArtifact, null ); + } - private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact ) - throws ArtifactResolutionException, ArtifactNotFoundException + private ArtifactResolutionResult resolveArtifact( Artifact providerArtifact, @Nullable Artifact excludeArtifact ) { - ArtifactFilter filter = null; - if ( filteredArtifact != null ) + ArtifactResolutionRequest request = new ArtifactResolutionRequest() + .setArtifact( providerArtifact ) + .setRemoteRepositories( remoteRepositories ) + .setLocalRepository( localRepository ) + .setResolveTransitively( true ); + if ( excludeArtifact != null ) { - filter = new ExcludesArtifactFilter( - Collections.singletonList( filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId() ) ); + String pattern = excludeArtifact.getGroupId() + ":" + excludeArtifact.getArtifactId(); + request.setCollectionFilter( new ExcludesArtifactFilter( singletonList( pattern ) ) ); } - - Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); - - return artifactResolver.resolveTransitively( singleton( providerArtifact ), originatingArtifact, - localRepository, remoteRepositories, artifactMetadataSource, - filter ); + return repositorySystem.resolve( request ); } @Nonnull - @SuppressWarnings( "unchecked" ) - public Set<Artifact> getProviderClasspath( String provider, String version, Artifact filteredArtifact ) - throws ArtifactNotFoundException, ArtifactResolutionException + Set<Artifact> getProviderClasspath( String provider, String version ) { Artifact providerArtifact = artifactFactory.createDependencyArtifact( "org.apache.maven.surefire", provider, createFromVersion( version ), "jar", null, SCOPE_TEST ); - ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact ); + ArtifactResolutionResult result = resolveArtifact( providerArtifact ); if ( log.isDebugEnabled() ) { - for ( Object o : result.getArtifacts() ) + for ( Artifact artifact : result.getArtifacts() ) { - Artifact artifact = (Artifact) o; String artifactPath = artifact.getFile().getAbsolutePath(); String scope = artifact.getScope(); log.debug( "Adding to " + pluginName + " test classpath: " + artifactPath + " Scope: " + scope ); @@ -156,13 +145,12 @@ public class SurefireDependencyResolver return result.getArtifacts(); } - public Set<Artifact> addProviderToClasspath( Map<String, Artifact> pluginArtifactMap, Artifact surefireArtifact ) - throws ArtifactResolutionException, ArtifactNotFoundException + Set<Artifact> addProviderToClasspath( Map<String, Artifact> pluginArtifactMap, Artifact surefireArtifact ) { Set<Artifact> providerArtifacts = new LinkedHashSet<Artifact>(); if ( surefireArtifact != null ) { - ArtifactResolutionResult artifactResolutionResult = resolveArtifact( null, surefireArtifact ); + final ArtifactResolutionResult artifactResolutionResult = resolveArtifact( surefireArtifact ); for ( Artifact artifact : pluginArtifactMap.values() ) { if ( !artifactResolutionResult.getArtifacts().contains( artifact ) ) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java index 44dbdd4..3e6e2c5 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java @@ -31,8 +31,6 @@ import org.apache.maven.surefire.util.internal.DumpFileUtils; import javax.annotation.Nonnull; import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Deque; @@ -185,27 +183,26 @@ public final class SurefireHelper cli.add( LOGGING_LEVEL_DEBUG ); } - try + MavenExecutionRequest request = session.getRequest(); + + if ( request.isShowErrors() ) { - Method getRequestMethod = session.getClass().getMethod( "getRequest" ); - MavenExecutionRequest request = (MavenExecutionRequest) getRequestMethod.invoke( session ); + cli.add( SHOW_ERRORS ); + } - if ( request.isShowErrors() ) + String failureBehavior = request.getReactorFailureBehavior(); + if ( failureBehavior != null ) + { + try { - cli.add( SHOW_ERRORS ); + cli.add( CommandLineOption.valueOf( failureBehavior ) ); } - - String f = getFailureBehavior( request ); - if ( f != null ) + catch ( IllegalArgumentException e ) { - // compatible with enums Maven 3.0 - cli.add( CommandLineOption.valueOf( f.startsWith( "REACTOR_" ) ? f : "REACTOR_" + f ) ); + // CommandLineOption does not have specified enum as string. See getRequest() method in Maven Session. } } - catch ( Exception e ) - { - // don't need to log the exception that Maven 2 does not have getRequest() method in Maven Session - } + return unmodifiableList( cli ); } @@ -250,21 +247,6 @@ public final class SurefireHelper return path; } - private static String getFailureBehavior( MavenExecutionRequest request ) - throws NoSuchMethodException, InvocationTargetException, IllegalAccessException - { - try - { - return request.getFailureBehavior(); - } - catch ( NoSuchMethodError e ) - { - return (String) request.getClass() - .getMethod( "getReactorFailureBehavior" ) - .invoke( request ); - } - } - private static boolean failIfNoTests( SurefireReportParameters reportParameters ) { return reportParameters.getFailIfNoTests() != null && reportParameters.getFailIfNoTests(); diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java index 372740a..88ac446 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java @@ -23,8 +23,7 @@ import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; import org.codehaus.plexus.logging.Logger; /** - * Wrapper logger of miscellaneous (Maven 2.2.1 or 3.1) implementations of {@link Logger}. - * Calling {@link Logger#isInfoEnabled()} before {@link Logger#info(String)} due to Maven 2.2.1. + * Wrapper logger of miscellaneous implementations of {@link Logger}. * * @author <a href="mailto:[email protected]">Tibor Digana (tibor17)</a> * @since 2.20 @@ -49,18 +48,12 @@ public final class PluginConsoleLogger @Override public void debug( String message ) { - if ( isDebugEnabled() ) - { - plexusLogger.debug( message ); - } + plexusLogger.debug( message ); } public void debug( CharSequence content, Throwable error ) { - if ( isDebugEnabled() ) - { - plexusLogger.debug( content == null ? "" : content.toString(), error ); - } + plexusLogger.debug( content == null ? "" : content.toString(), error ); } @Override @@ -72,10 +65,7 @@ public final class PluginConsoleLogger @Override public void info( String message ) { - if ( isInfoEnabled() ) - { - plexusLogger.info( message ); - } + plexusLogger.info( message ); } @Override @@ -87,18 +77,12 @@ public final class PluginConsoleLogger @Override public void warning( String message ) { - if ( isWarnEnabled() ) - { - plexusLogger.warn( message ); - } + plexusLogger.warn( message ); } public void warning( CharSequence content, Throwable error ) { - if ( isWarnEnabled() ) - { - plexusLogger.warn( content == null ? "" : content.toString(), error ); - } + plexusLogger.warn( content == null ? "" : content.toString(), error ); } @Override @@ -110,27 +94,18 @@ public final class PluginConsoleLogger @Override public void error( String message ) { - if ( isErrorEnabled() ) - { - plexusLogger.error( message ); - } + plexusLogger.error( message ); } @Override public void error( String message, Throwable t ) { - if ( isErrorEnabled() ) - { - plexusLogger.error( message, t ); - } + plexusLogger.error( message, t ); } @Override public void error( Throwable t ) { - if ( isErrorEnabled() ) - { - plexusLogger.error( "", t ); - } + plexusLogger.error( "", t ); } } diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java index 3db6ebd..dd652a8 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java @@ -442,20 +442,19 @@ public class DefaultReporterFactory private void log( String s, Level level ) { - MessageBuilder builder = buffer(); switch ( level ) { case FAILURE: - consoleLogger.error( builder.failure( s ).toString() ); + failure( s ); break; case UNSTABLE: - consoleLogger.warning( builder.warning( s ).toString() ); + warning( s ); break; case SUCCESS: - consoleLogger.info( builder.success( s ).toString() ); + success( s ); break; default: - consoleLogger.info( builder.a( s ).toString() ); + info( s ); } } @@ -467,13 +466,13 @@ public class DefaultReporterFactory private void info( String s ) { MessageBuilder builder = buffer(); - consoleLogger.info( builder.info( s ).toString() ); + consoleLogger.info( builder.a( s ).toString() ); } - private void err( String s ) + private void warning( String s ) { MessageBuilder builder = buffer(); - consoleLogger.error( builder.error( s ).toString() ); + consoleLogger.warning( builder.warning( s ).toString() ); } private void success( String s ) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java index 0773788..defd575 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java @@ -19,6 +19,7 @@ package org.apache.maven.plugin.surefire.report; * under the License. */ +import org.apache.maven.plugin.surefire.booterclient.output.InPluginProcessDumpSingleton; import org.apache.maven.shared.utils.xml.PrettyPrintXMLWriter; import org.apache.maven.shared.utils.xml.XMLWriter; import org.apache.maven.surefire.report.ReportEntry; @@ -238,6 +239,14 @@ public class StatelessXmlReporter } ppw.endElement(); // TestSuite } + catch ( IOException e ) + { + // It's not a test error. + // This method must be sail-safe and errors are in a dump log. + // The control flow must not be broken in TestSetRunListener#testSetCompleted. + InPluginProcessDumpSingleton.getSingleton() + .dumpException( e, e.getLocalizedMessage(), reportsDirectory ); + } finally { closeQuietly( fw ); @@ -324,7 +333,7 @@ public class StatelessXmlReporter } private static void startTestElement( XMLWriter ppw, WrappedReportEntry report, String reportNameSuffix, - String timeAsString ) + String timeAsString ) throws IOException { ppw.startElement( "testcase" ); ppw.addAttribute( "name", report.getReportName() ); @@ -347,7 +356,7 @@ public class StatelessXmlReporter } private void createTestSuiteElement( XMLWriter ppw, WrappedReportEntry report, TestSetStats testSetStats, - String timeAsString ) + String timeAsString ) throws IOException { ppw.startElement( "testsuite" ); @@ -374,7 +383,7 @@ public class StatelessXmlReporter private static void getTestProblems( OutputStreamWriter outputStreamWriter, XMLWriter ppw, WrappedReportEntry report, boolean trimStackTrace, OutputStream fw, - String testErrorType, boolean createOutErrElementsInside ) + String testErrorType, boolean createOutErrElementsInside ) throws IOException { ppw.startElement( testErrorType ); @@ -431,7 +440,7 @@ public class StatelessXmlReporter // Create system-out and system-err elements private static void createOutErrElements( OutputStreamWriter outputStreamWriter, XMLWriter ppw, - WrappedReportEntry report, OutputStream fw ) + WrappedReportEntry report, OutputStream fw ) throws IOException { EncodingOutputStream eos = new EncodingOutputStream( fw ); addOutputStreamElement( outputStreamWriter, eos, ppw, report.getStdout(), "system-out" ); @@ -441,7 +450,7 @@ public class StatelessXmlReporter private static void addOutputStreamElement( OutputStreamWriter outputStreamWriter, EncodingOutputStream eos, XMLWriter xmlWriter, Utf8RecodingDeferredFileOutputStream utf8RecodingDeferredFileOutputStream, - String name ) + String name ) throws IOException { if ( utf8RecodingDeferredFileOutputStream != null && utf8RecodingDeferredFileOutputStream.getByteCount() > 0 ) { @@ -471,7 +480,7 @@ public class StatelessXmlReporter * * @param xmlWriter The test suite to report to */ - private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties ) + private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties ) throws IOException { xmlWriter.startElement( "properties" ); for ( final Entry<String, String> entry : systemProperties.entrySet() ) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java index 9d3c974..62060f1 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java @@ -193,7 +193,7 @@ public class TestSetRunListener } // ---------------------------------------------------------------------- - // Test + // Test callback methods: // ---------------------------------------------------------------------- @Override diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java index 22c3f52..5ef6ade 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java @@ -268,7 +268,6 @@ public class AbstractSurefireMojoTest verify( mojo, times( 1 ) ).isChildDelegation(); verifyPrivate( mojo, times( 1 ) ).invoke( "generateTestClasspath" ); verify( mojo, times( 1 ) ).getEffectiveForkCount(); - verify( logger, times( 6 ) ).isDebugEnabled(); ArgumentCaptor<String> argument = ArgumentCaptor.forClass( String.class ); verify( logger, times( 6 ) ).debug( argument.capture() ); assertThat( argument.getAllValues() ) diff --git a/maven-surefire-plugin/pom.xml b/maven-surefire-plugin/pom.xml index 9ac4d00..b9183c7 100644 --- a/maven-surefire-plugin/pom.xml +++ b/maven-surefire-plugin/pom.xml @@ -35,7 +35,7 @@ <description>Maven Surefire MOJO in maven-surefire-plugin.</description> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <properties> @@ -47,6 +47,11 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>maven-surefire-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-artifact-transfer</artifactId> </dependency> </dependencies> diff --git a/maven-surefire-plugin/src/site/apt/index.apt.vm b/maven-surefire-plugin/src/site/apt/index.apt.vm index f7270fc..7482ae6 100644 --- a/maven-surefire-plugin/src/site/apt/index.apt.vm +++ b/maven-surefire-plugin/src/site/apt/index.apt.vm @@ -31,7 +31,7 @@ Maven ${thisPlugin} Plugin - Requirements: Maven 2.2.1 or 3.x, and JDK 1.6 or higher. Due to wrong formatting of console text messages + Requirements: Maven 3.x and JDK 1.7 or higher. Due to wrong formatting of console text messages in Maven Version prior to 3.1.0 it is highly recommended to use Maven 3.1.0 or higher. #{if}(${project.artifactId}=="maven-surefire-plugin") diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index 9e04880..ebd8227 100644 --- a/maven-surefire-report-plugin/pom.xml +++ b/maven-surefire-report-plugin/pom.xml @@ -49,7 +49,7 @@ <dependencies> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-core</artifactId> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -78,6 +78,12 @@ <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-impl</artifactId> <version>2.4</version> + <exclusions> + <exclusion> + <artifactId>maven-project</artifactId> + <groupId>org.apache.maven</groupId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> @@ -86,7 +92,7 @@ </dependency> <dependency> <!-- using the same transient version 3.0.15 from doxia-site-renderer:1.6 which is in conflict - with version 1.5.15 in maven-project:2.2.1 on the same level of dependency tree --> + with version 1.5.15 in maven-project:3.0 on the same level of dependency tree --> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>3.0.15</version> @@ -94,13 +100,26 @@ <dependency> <groupId>org.fusesource.jansi</groupId> <artifactId>jansi</artifactId> - <version>1.13</version> <scope>provided</scope> </dependency> <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> - <version>1.2</version> + <version>2.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-compat</artifactId> <scope>test</scope> </dependency> <dependency> @@ -154,39 +173,45 @@ </executions> </plugin> <plugin> - <artifactId>maven-dependency-plugin</artifactId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <useSystemClassLoader>true</useSystemClassLoader> + <classpathDependencyExcludes> + <classpathDependencyExclude>org.fusesource.jansi:jansi</classpathDependencyExclude> + </classpathDependencyExcludes> + </configuration> + </plugin> + <plugin> + <artifactId>maven-shade-plugin</artifactId> <executions> <execution> - <id>shared-logging-generated-sources</id> - <phase>generate-sources</phase> + <phase>package</phase> <goals> - <goal>unpack</goal> + <goal>shade</goal> </goals> <configuration> - <outputDirectory>${project.build.directory}/generated-sources/dependency</outputDirectory> - <overWriteIfNewer>false</overWriteIfNewer> - <artifact>org.apache.maven.shared:maven-shared-utils:3.1.0:jar:sources</artifact> - <includes>org/apache/maven/shared/utils/logging/*.java</includes> + <minimizeJar>true</minimizeJar> + <artifactSet> + <includes> + <include>org.apache.maven.shared:maven-shared-utils</include> + </includes> + </artifactSet> + <relocations> + <relocation> + <pattern>org.apache.maven.shared</pattern> + <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> + </relocation> + </relocations> </configuration> </execution> </executions> </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <useSystemClassLoader>true</useSystemClassLoader> - <classpathDependencyExcludes> - <classpathDependencyExclude>org.fusesource.jansi:jansi</classpathDependencyExclude> - </classpathDependencyExcludes> - </configuration> - </plugin> </plugins> </build> <reporting> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> </plugin> </plugins> @@ -233,7 +258,6 @@ </configuration> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <configuration> <skip>false</skip> diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/PluginConsoleLogger.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/PluginConsoleLogger.java index 0e0fb99..5070364 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/PluginConsoleLogger.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/PluginConsoleLogger.java @@ -27,8 +27,7 @@ import static java.lang.Integer.numberOfLeadingZeros; import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; /** - * Wrapper logger of miscellaneous (Maven 2.2.1 or 3.1) implementations of {@link Log}. - * Calling {@link Log#isInfoEnabled()} before {@link Log#info(CharSequence)} due to Maven 2.2.1. + * Wrapper logger of miscellaneous implementations of {@link Log}. * * @author <a href="mailto:[email protected]">Tibor Digana (tibor17)</a> * @since 2.20 @@ -53,18 +52,12 @@ final class PluginConsoleLogger @Override public void debug( String message ) { - if ( mojoLogger.isDebugEnabled() ) - { - mojoLogger.debug( createAnsiBuilder( message ).debug( message ).toString() ); - } + mojoLogger.debug( createAnsiBuilder( message ).a( message ).toString() ); } public void debug( CharSequence content, Throwable error ) { - if ( mojoLogger.isDebugEnabled() ) - { - mojoLogger.debug( content, error ); - } + mojoLogger.debug( content, error ); } @Override @@ -76,10 +69,7 @@ final class PluginConsoleLogger @Override public void info( String message ) { - if ( mojoLogger.isInfoEnabled() ) - { - mojoLogger.info( createAnsiBuilder( message ).info( message ).toString() ); - } + mojoLogger.info( createAnsiBuilder( message ).a( message ).toString() ); } @Override @@ -91,18 +81,12 @@ final class PluginConsoleLogger @Override public void warning( String message ) { - if ( mojoLogger.isWarnEnabled() ) - { - mojoLogger.warn( createAnsiBuilder( message ).warning( message ).toString() ); - } + mojoLogger.warn( createAnsiBuilder( message ).warning( message ).toString() ); } public void warn( CharSequence content, Throwable error ) { - if ( mojoLogger.isWarnEnabled() ) - { - mojoLogger.warn( content, error ); - } + mojoLogger.warn( content, error ); } @Override @@ -114,28 +98,19 @@ final class PluginConsoleLogger @Override public void error( String message ) { - if ( mojoLogger.isErrorEnabled() ) - { - mojoLogger.error( createAnsiBuilder( message ).error( message ).toString() ); - } + mojoLogger.error( createAnsiBuilder( message ).failure( message ).toString() ); } @Override public void error( String message, Throwable t ) { - if ( mojoLogger.isErrorEnabled() ) - { - mojoLogger.error( message, t ); - } + mojoLogger.error( message, t ); } @Override public void error( Throwable t ) { - if ( mojoLogger.isErrorEnabled() ) - { - mojoLogger.error( t ); - } + mojoLogger.error( t ); } private static MessageBuilder createAnsiBuilder( CharSequence message ) diff --git a/pom.xml b/pom.xml index 99c9746..3313d8c 100644 --- a/pom.xml +++ b/pom.xml @@ -84,11 +84,11 @@ </distributionManagement> <properties> - <mavenVersion>2.2.1</mavenVersion> + <mavenVersion>3.0</mavenVersion> <!-- <shadedVersion>2.12.4</shadedVersion> commented out due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <commonsLang3Version>3.5</commonsLang3Version> <commonsIoVersion>2.5</commonsIoVersion> - <mavenSharedUtilsVersion>0.9</mavenSharedUtilsVersion> + <mavenSharedUtilsVersion>3.2.1</mavenSharedUtilsVersion> <powermockVersion>2.0.0-beta.5</powermockVersion> <maven.surefire.scm.devConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-surefire.git</maven.surefire.scm.devConnection> <maven.site.path>surefire-archives/surefire-LATEST</maven.site.path> @@ -102,11 +102,6 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>${commonsLang3Version}</version> @@ -117,29 +112,9 @@ <version>${commonsIoVersion}</version> </dependency> <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-booter</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-logger-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-grouper</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>maven-surefire-common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-api</artifactId> - <version>3.0</version> + <version>${mavenVersion}</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -189,7 +164,6 @@ <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> <version>${mavenPluginToolsVersion}</version> - <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -198,22 +172,12 @@ </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-descriptor</artifactId> - <version>${mavenVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>${mavenVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> <artifactId>maven-model</artifactId> <version>${mavenVersion}</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-toolchain</artifactId> + <artifactId>maven-compat</artifactId> <version>${mavenVersion}</version> </dependency> <dependency> @@ -227,15 +191,25 @@ <version>${mavenSharedUtilsVersion}</version> <exclusions> <exclusion> - <groupId>com.google.code.findbugs</groupId> - <artifactId>jsr305</artifactId> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> </exclusion> </exclusions> </dependency> <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-toolchain</artifactId> + <version>3.0-alpha-2</version> + </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-artifact-transfer</artifactId> + <version>0.10.0</version> + </dependency> + <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-common-artifact-filters</artifactId> - <version>1.3</version> + <version>3.0.1</version> <exclusions> <exclusion> <groupId>org.apache.maven.shared</groupId> @@ -259,6 +233,16 @@ <version>0.9.10</version> </dependency> <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>1.3.1</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.3.1</version> + </dependency> + <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>2.21.0</version> @@ -277,7 +261,6 @@ <groupId>org.powermock</groupId> <artifactId>powermock-core</artifactId> <version>${powermockVersion}</version> - <scope>test</scope> <exclusions> <exclusion> <groupId>net.bytebuddy</groupId> @@ -303,13 +286,11 @@ <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>${powermockVersion}</version> - <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito2</artifactId> <version>${powermockVersion}</version> - <scope>test</scope> </dependency> <!-- END: PowerMock@Java9 --> <dependency> @@ -469,6 +450,10 @@ </configuration> </plugin> <plugin> + <artifactId>maven-shade-plugin</artifactId> + <version>1.4</version> + </plugin> + <plugin> <artifactId>maven-plugin-plugin</artifactId> <configuration> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> @@ -514,7 +499,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> - <version>3.0.0-M1</version> + <version>3.0.0-M2</version> <executions> <execution> <id>enforce-java</id> @@ -630,28 +615,6 @@ <profiles> <profile> <id>reporting</id> - <build> - <pluginManagement> - <plugins> - <!-- Moving to a profile, since these dependencies won't exist the first - time a new snapshot version is built. This prevents the first - snapshot build from proceeding beyond the build for the top-level - Surefire parent POM. - --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-site-plugin</artifactId> - <dependencies> - <!-- dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-shadefire</artifactId> - <version>${project.version}</version> - </dependency --> - </dependencies> - </plugin> - </plugins> - </pluginManagement> - </build> <reporting> <plugins> <plugin> @@ -671,37 +634,5 @@ </plugins> </reporting> </profile> - <profile> - <id>m2e</id> - <properties> - <m2BuildDirectory>target</m2BuildDirectory> - </properties> - <activation> - <property> - <name>m2e.version</name> - </property> - </activation> - <build> - <directory>${m2BuildDirectory}</directory> - <plugins> - <plugin> - <groupId>org.maven.ide.eclipse</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>0.10.0</version> - <configuration> - <mappingId>customizable</mappingId> - <configurators> - <configurator id="org.maven.ide.eclipse.jdt.javaConfigurator" /> - <configurator id="org.maven.ide.eclipse.modello.modelloConfigurator" /> - <configurator id="org.maven.ide.eclipse.plexus.annotations.plexusConfigurator" /> - </configurators> - <mojoExecutions> - <mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution> - </mojoExecutions> - </configuration> - </plugin> - </plugins> - </build> - </profile> </profiles> </project> diff --git a/surefire-api/pom.xml b/surefire-api/pom.xml index 2e5f41c..b432b01 100644 --- a/surefire-api/pom.xml +++ b/surefire-api/pom.xml @@ -35,6 +35,7 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-logger-api</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> @@ -65,7 +66,6 @@ </dependencies> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -83,7 +83,7 @@ <relocations> <relocation> <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.api.org.apache.maven.shared</shadedPattern> </relocation> </relocations> </configuration> diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml index 570c0a0..bab1175 100644 --- a/surefire-booter/pom.xml +++ b/surefire-booter/pom.xml @@ -35,6 +35,7 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-api</artifactId> + <version>${project.version}</version> <exclusions> <exclusion> <groupId>org.apache.maven.shared</groupId> @@ -126,7 +127,6 @@ </configuration> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -145,11 +145,11 @@ <relocations> <relocation> <pattern>org.apache.commons.lang3</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.commons.lang3</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.booter.org.apache.commons.lang3</shadedPattern> </relocation> <relocation> <pattern>org.apache.commons.io</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.commons.io</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.booter.org.apache.commons.io</shadedPattern> </relocation> </relocations> </configuration> diff --git a/surefire-grouper/pom.xml b/surefire-grouper/pom.xml index 69079d5..e722892 100644 --- a/surefire-grouper/pom.xml +++ b/surefire-grouper/pom.xml @@ -33,7 +33,7 @@ <description>Maven Surefire Test-Grouping Support</description> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <build> diff --git a/surefire-its/src/test/resources/SurefireToolchains/pom.xml b/surefire-its/src/test/resources/SurefireToolchains/pom.xml index 2d066eb..2a1df26 100644 --- a/surefire-its/src/test/resources/SurefireToolchains/pom.xml +++ b/surefire-its/src/test/resources/SurefireToolchains/pom.xml @@ -15,7 +15,7 @@ </properties> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <dependencies> diff --git a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml index 0c4a15e..e893fec 100644 --- a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml +++ b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml @@ -20,7 +20,7 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> - <version>2.2.1</version> + <version>3.0</version> </dependency> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> diff --git a/surefire-its/src/test/resources/testng-listeners/src/test/java/listeners/MarkAsFailureListener.java b/surefire-its/src/test/resources/testng-listeners/src/test/java/listeners/MarkAsFailureListener.java index 5ba401f..a104604 100644 --- a/surefire-its/src/test/resources/testng-listeners/src/test/java/listeners/MarkAsFailureListener.java +++ b/surefire-its/src/test/resources/testng-listeners/src/test/java/listeners/MarkAsFailureListener.java @@ -31,12 +31,12 @@ import org.testng.ITestResult; */ public class MarkAsFailureListener implements ITestListener, IInvokedMethodListener { - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onTestStart(ITestResult result) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onTestSuccess(ITestResult result) { } @@ -46,37 +46,37 @@ public class MarkAsFailureListener implements ITestListener, IInvokedMethodListe * I will be called twice in some condition!!! * @param result */ - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onTestFailure(ITestResult result) { System.out.println(++counter); } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onTestSkipped(ITestResult result) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onTestFailedButWithinSuccessPercentage(ITestResult result) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onStart(ITestContext context) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void onFinish(ITestContext context) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { } - //todo add @Override in surefire 3.0 running on the top of JDK 6 + @Override public void afterInvocation(IInvokedMethod method, ITestResult testResult) { testResult.setStatus(ITestResult.FAILURE); } diff --git a/surefire-providers/common-java5/pom.xml b/surefire-providers/common-java5/pom.xml index 0d0bc78..6fe9f44 100644 --- a/surefire-providers/common-java5/pom.xml +++ b/surefire-providers/common-java5/pom.xml @@ -41,7 +41,6 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -51,10 +50,15 @@ </goals> <configuration> <minimizeJar>true</minimizeJar> + <artifactSet> + <includes> + <include>org.apache.maven.shared:maven-shared-utils</include> + </includes> + </artifactSet> <relocations> <relocation> - <pattern>org.codehaus.plexus.util</pattern> - <shadedPattern>org.apache.maven.surefire.commonjunit48.org.codehaus.plexus.util</shadedPattern> + <pattern>org.apache.maven.shared</pattern> + <shadedPattern>org.apache.maven.surefire.shade.java5.org.apache.maven.shared</shadedPattern> </relocation> </relocations> </configuration> diff --git a/surefire-providers/common-junit4/pom.xml b/surefire-providers/common-junit4/pom.xml index c109674..65450ad 100644 --- a/surefire-providers/common-junit4/pom.xml +++ b/surefire-providers/common-junit4/pom.xml @@ -51,7 +51,36 @@ <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-shared-utils</artifactId> - <scope>compile</scope><!-- somewhere managed with scope provided --> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <minimizeJar>true</minimizeJar> + <artifactSet> + <includes> + <include>org.apache.maven.shared:maven-shared-utils</include> + </includes> + </artifactSet> + <relocations> + <relocation> + <pattern>org.apache.maven.shared</pattern> + <shadedPattern>org.apache.maven.surefire.shade.commonjunit4.org.apache.maven.shared</shadedPattern> + </relocation> + </relocations> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/surefire-providers/common-junit48/pom.xml b/surefire-providers/common-junit48/pom.xml index 38e7e41..f014f7f 100644 --- a/surefire-providers/common-junit48/pom.xml +++ b/surefire-providers/common-junit48/pom.xml @@ -42,48 +42,22 @@ <groupId>org.apache.maven.surefire</groupId> <artifactId>common-junit4</artifactId> <version>${project.version}</version> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-grouper</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> + <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>org.codehaus.plexus:plexus-utils</include> - </includes> - </artifactSet> - <relocations> - <relocation> - <pattern>org.codehaus.plexus.util</pattern> - <shadedPattern>org.apache.maven.surefire.commonjunit48.org.codehaus.plexus.util</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <includes> diff --git a/surefire-providers/pom.xml b/surefire-providers/pom.xml index 73b4248..85826d2 100644 --- a/surefire-providers/pom.xml +++ b/surefire-providers/pom.xml @@ -50,6 +50,7 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-api</artifactId> + <version>${project.version}</version> </dependency> </dependencies> diff --git a/surefire-providers/surefire-junit-platform/pom.xml b/surefire-providers/surefire-junit-platform/pom.xml index fc93e74..e5c4897 100644 --- a/surefire-providers/surefire-junit-platform/pom.xml +++ b/surefire-providers/surefire-junit-platform/pom.xml @@ -27,11 +27,14 @@ </parent> <artifactId>surefire-junit-platform</artifactId> + <name>SureFire JUnit Platform Runner</name> <description>SureFire JUnit Platform Runner</description> + <properties> <javaVersion>8</javaVersion> </properties> + <contributors> <contributor> <name>Konstantin Lutovich</name> @@ -86,12 +89,10 @@ <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> - <version>1.3.1</version> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> - <version>5.3.1</version> <scope>test</scope> </dependency> <dependency> @@ -134,42 +135,12 @@ </executions> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> + <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> <configuration> <jvm>${java.home}/bin/java</jvm> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>org.apache.maven.surefire:common-java5</include> - </includes> - </artifactSet> - <relocations> - <relocation> - <pattern>javax.annotation</pattern> - <shadedPattern>org.apache.maven.surefire.javax.annotation</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.org.apache.maven.shared</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> </project> diff --git a/surefire-providers/surefire-junit3/pom.xml b/surefire-providers/surefire-junit3/pom.xml index a96cc0d..2f5a7af 100644 --- a/surefire-providers/surefire-junit3/pom.xml +++ b/surefire-providers/surefire-junit3/pom.xml @@ -44,35 +44,4 @@ <version>${project.version}</version> </dependency> </dependencies> - - <build> - <resources> - <resource> - <directory>src/main/resources/META-INF</directory> - <targetPath>META-INF</targetPath> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <artifactSet> - <includes> - <include>org.apache.maven.surefire:common-junit3</include> - </includes> - </artifactSet> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </project> diff --git a/surefire-providers/surefire-junit4/pom.xml b/surefire-providers/surefire-junit4/pom.xml index c806d37..97031dd 100644 --- a/surefire-providers/surefire-junit4/pom.xml +++ b/surefire-providers/surefire-junit4/pom.xml @@ -44,46 +44,4 @@ <version>${project.version}</version> </dependency> </dependencies> - - <build> - <resources> - <resource> - <directory>src/main/resources/META-INF</directory> - <targetPath>META-INF</targetPath> - </resource> - </resources> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>1.4</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>org.apache.maven.surefire:common-junit3</include> - <include>org.apache.maven.surefire:common-junit4</include> - <include>org.apache.maven.surefire:common-java5</include> - <include>org.apache.maven.shared:maven-shared-utils</include> - </includes> - </artifactSet> - <relocations> - <relocation> - <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> </project> diff --git a/surefire-providers/surefire-junit47/pom.xml b/surefire-providers/surefire-junit47/pom.xml index 756bd9d..c2ce55a 100644 --- a/surefire-providers/surefire-junit47/pom.xml +++ b/surefire-providers/surefire-junit47/pom.xml @@ -33,10 +33,9 @@ <dependencies> <dependency> - <groupId>com.github.stephenc.jcip</groupId> - <artifactId>jcip-annotations</artifactId> - <version>1.0-1</version> - <scope>test</scope> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>common-junit48</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>junit</groupId> @@ -47,23 +46,18 @@ <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>maven-surefire-common</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>common-junit48</artifactId> - <version>${project.version}</version> + <groupId>com.github.stephenc.jcip</groupId> + <artifactId>jcip-annotations</artifactId> + <version>1.0-1</version> + <scope>test</scope> </dependency> </dependencies> <build> - <resources> - <resource> - <directory>src/main/resources/META-INF</directory> - <targetPath>META-INF</targetPath> - </resource> - </resources> - <plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> @@ -131,7 +125,6 @@ </configuration> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -141,23 +134,12 @@ </goals> <configuration> <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>org.apache.maven.surefire:common-junit3</include> - <include>org.apache.maven.surefire:common-junit4</include> - <include>org.apache.maven.surefire:common-java5</include> - </includes> - </artifactSet> <relocations> <relocation> <pattern>javax.annotation</pattern> <shadedPattern>org.apache.maven.surefire.javax.annotation</shadedPattern> </relocation> <relocation> - <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.org.apache.maven.shared</shadedPattern> - </relocation> - <relocation> <pattern>org.apache.maven.surefire.junitcore.ThreadSafe</pattern> <shadedPattern>org.junit.runner.notification.RunListener.ThreadSafe</shadedPattern> <excludes> diff --git a/surefire-providers/surefire-testng-utils/pom.xml b/surefire-providers/surefire-testng-utils/pom.xml index 3a812a9..aa6e221 100644 --- a/surefire-providers/surefire-testng-utils/pom.xml +++ b/surefire-providers/surefire-testng-utils/pom.xml @@ -39,12 +39,9 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-shared-utils</artifactId> - </dependency> - <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-grouper</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.testng</groupId> @@ -58,32 +55,6 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>org.apache.maven.shared:maven-shared-utils</include> - </includes> - </artifactSet> - <relocations> - <relocation> - <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <artifactId>maven-surefire-plugin</artifactId> <dependencies> <dependency> diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml index 9c28f13..78ebae1 100644 --- a/surefire-providers/surefire-testng/pom.xml +++ b/surefire-providers/surefire-testng/pom.xml @@ -58,12 +58,6 @@ </dependencies> <build> - <resources> - <resource> - <directory>src/main/resources/META-INF</directory> - <targetPath>META-INF</targetPath> - </resource> - </resources> <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> diff --git a/surefire-report-parser/pom.xml b/surefire-report-parser/pom.xml index 944dad0..cd99305 100644 --- a/surefire-report-parser/pom.xml +++ b/surefire-report-parser/pom.xml @@ -33,13 +33,14 @@ <description>Parses report output files from surefire.</description> <prerequisites> - <maven>2.2.1</maven> + <maven>3.0</maven> </prerequisites> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-logger-api</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> @@ -68,8 +69,6 @@ </configuration> </plugin> <plugin> - <!-- Do we need shading here ?? --> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> @@ -87,7 +86,7 @@ <relocations> <relocation> <pattern>org.apache.maven.shared</pattern> - <shadedPattern>org.apache.maven.surefire.shade.org.apache.maven.shared</shadedPattern> + <shadedPattern>org.apache.maven.surefire.shade.report.org.apache.maven.shared</shadedPattern> </relocation> </relocations> </configuration> diff --git a/surefire-shadefire/pom.xml b/surefire-shadefire/pom.xml index f4790a1..b795c08 100644 --- a/surefire-shadefire/pom.xml +++ b/surefire-shadefire/pom.xml @@ -63,9 +63,7 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <version>1.4</version> <executions> <execution> <phase>package</phase> @@ -73,7 +71,6 @@ <goal>shade</goal> </goals> <configuration> - <!-- minimizeJar>true</minimizeJar --> <artifactSet> <includes> <include>org.apache.maven.surefire:surefire-api</include>
