From 97e8ae273784d86d3cb6b7849848c05919ac4896 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 29 Nov 2012 08:47:44 -0800 Subject: [PATCH 001/102] - wind this back to version 2.2 --- .../src/main/resources/META-INF/plexus/default-bindings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml b/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml index 39fe4bb8a3..09ecba441e 100644 --- a/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml +++ b/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml @@ -258,7 +258,7 @@ Mappings to default lifecycle, specific for each packaging. org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test - org.apache.maven.plugins:maven-war-plugin:2.3:war + org.apache.maven.plugins:maven-war-plugin:2.2:war org.apache.maven.plugins:maven-install-plugin:2.4:install From a3047b362941c714c6a6cce2657e12743a6e1667 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 30 Nov 2012 00:07:15 +0100 Subject: [PATCH 002/102] test push --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3b97b69e1f..c53f01d78a 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 22 ../pom/maven/pom.xml - + maven 3.1-SNAPSHOT pom From 1fe432b5de7f74fa2e6859245f8d3e63675a0286 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 30 Nov 2012 00:07:27 +0100 Subject: [PATCH 003/102] revert test push --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c53f01d78a..3b97b69e1f 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 22 ../pom/maven/pom.xml - + maven 3.1-SNAPSHOT pom From 620137ebca11958057fd01055d2322ce210a3c11 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Thu, 29 Nov 2012 21:51:11 -0800 Subject: [PATCH 004/102] MNG-5386: Dispose of ClassRealms after invocation to prevent out of Permgen errors (update to classworlds 2.4.1) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3b97b69e1f..8ca52d81db 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ 2001 - 2.4 + 2.4.1 1.2 1.2_Java1.3 3.8.2 From e8df4ca99369faec750590ce167d9bfc0af40f0d Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Thu, 29 Nov 2012 22:03:08 +0100 Subject: [PATCH 005/102] o Restored old context classloader so the threads dont go running around with classloaders that should unload --- .../maven/artifact/resolver/DefaultArtifactResolver.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 9c8364d461..e75c61d603 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -574,6 +574,7 @@ public class DefaultArtifactResolver public void run() { + ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( classLoader ); @@ -602,6 +603,8 @@ public class DefaultArtifactResolver finally { latch.countDown(); + Thread.currentThread().setContextClassLoader( old ); + } } From 2103c82d57b3f617cafa2796efeda97b85369465 Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Thu, 29 Nov 2012 22:17:04 +0100 Subject: [PATCH 006/102] o Changed array to atomicreference since arrays are not thread-safe --- .../plugin/internal/DefaultLegacySupport.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java index aea096316e..53e5f3028f 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java @@ -19,9 +19,11 @@ package org.apache.maven.plugin.internal; * under the License. */ +import java.util.concurrent.atomic.AtomicReference; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.LegacySupport; import org.codehaus.plexus.component.annotations.Component; + import org.sonatype.aether.RepositorySystemSession; /** @@ -37,29 +39,29 @@ public class DefaultLegacySupport implements LegacySupport { - private static final ThreadLocal session = new InheritableThreadLocal(); + private static final ThreadLocal> session = new InheritableThreadLocal>(); public void setSession( MavenSession session ) { if ( session == null ) { - MavenSession[] oldSession = DefaultLegacySupport.session.get(); + AtomicReference oldSession = DefaultLegacySupport.session.get(); if ( oldSession != null ) { - oldSession[0] = null; + oldSession.set( null); DefaultLegacySupport.session.remove(); } } else { - DefaultLegacySupport.session.set( new MavenSession[] { session } ); + DefaultLegacySupport.session.set( new AtomicReference( session )); } } public MavenSession getSession() { - MavenSession[] currentSession = DefaultLegacySupport.session.get(); - return currentSession != null ? currentSession[0] : null; + AtomicReference currentSession = DefaultLegacySupport.session.get(); + return currentSession != null ? currentSession.get() : null; } public RepositorySystemSession getRepositorySession() From 9712df3ded86482a1809d7652fda774d13585e8d Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Thu, 29 Nov 2012 18:01:00 +0100 Subject: [PATCH 007/102] o Fixed another classloader leak where core was grabbing random elements in plugin classloaders --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8ca52d81db..f78cc44d7a 100644 --- a/pom.xml +++ b/pom.xml @@ -47,8 +47,8 @@ 1.2_Java1.3 3.8.2 1.5.5 - 1.14 - 3.0.9 + 1.16 + 3.0.10 2.3.0 2.3 1.3 From a278bec9d3238136beed50b658a7a0aa6b4b110a Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Thu, 29 Nov 2012 18:45:00 +0100 Subject: [PATCH 008/102] o Fixed another super-subtle classloader leak --- .../plugin/internal/DefaultLegacySupport.java | 15 ++-- .../internal/DefaultLegacySupportTest.java | 74 +++++++++++++++++++ 2 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java index 53e5f3028f..78790d7956 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java @@ -43,14 +43,15 @@ public class DefaultLegacySupport public void setSession( MavenSession session ) { - if ( session == null ) + AtomicReference reference = DefaultLegacySupport.session.get(); + if ( reference != null ) { - AtomicReference oldSession = DefaultLegacySupport.session.get(); - if ( oldSession != null ) - { - oldSession.set( null); - DefaultLegacySupport.session.remove(); - } + reference.set( null); + } + + if ( session == null && reference != null) + { + DefaultLegacySupport.session.remove(); } else { diff --git a/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java b/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java new file mode 100644 index 0000000000..d350770cbc --- /dev/null +++ b/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java @@ -0,0 +1,74 @@ +package org.apache.maven.plugin.internal; +/* + * 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 junit.framework.TestCase; +import org.apache.maven.execution.DefaultMavenExecutionRequest; +import org.apache.maven.execution.MavenExecutionRequest; +import org.apache.maven.execution.MavenSession; + +import java.util.concurrent.CountDownLatch; + +/** + * @author Kristian Rosenvold + */ +public class DefaultLegacySupportTest extends TestCase { + final CountDownLatch latch = new CountDownLatch(1); + final DefaultLegacySupport defaultLegacySupport = new DefaultLegacySupport(); + + public void testSetSession() throws Exception { + + MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); + MavenSession m1 = new MavenSession(null, null, mavenExecutionRequest, null); + defaultLegacySupport.setSession(m1); + + MyRunnable myRunnable = new MyRunnable(); + Thread thread = new Thread(myRunnable); + thread.start(); + + MavenSession m2 = new MavenSession(null, null, mavenExecutionRequest, null); + defaultLegacySupport.setSession(m2); + latch.countDown(); + thread.join(); + assertNull( myRunnable.getSession()); + } + + + class MyRunnable implements Runnable { + + private volatile MavenSession session; + + public void run() { + try + { + latch.await(); + } + catch (InterruptedException ingore) + { + // Test may fail if we get interrupted + } + session = defaultLegacySupport.getSession(); + } + + public MavenSession getSession() { + return session; + } + } + +} From 4c8b3009d1e6f7f2df221f0cfc7a4b9ca36f50a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Fri, 30 Nov 2012 19:56:20 +0100 Subject: [PATCH 009/102] removed non-aggregate reportSets which duplicate default ones (then cause twice plugin invocation) --- pom.xml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pom.xml b/pom.xml index f78cc44d7a..7c53729fda 100644 --- a/pom.xml +++ b/pom.xml @@ -488,13 +488,6 @@ - - non-aggregate - - javadoc - test-javadoc - - aggregate false @@ -509,13 +502,6 @@ maven-jxr-plugin 2.3 - - non-aggregate - - jxr - test-jxr - - aggregate false From d5e5717dd7955a036d0e991db1db71d964f97a4c Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Fri, 30 Nov 2012 15:05:12 -0800 Subject: [PATCH 010/102] [MNG-5390] mvn -rf (no argument) results in NPE Created a simple primordial logger that implements the error methods required between CLI parsing and logger initialization. I don't want to have to look to see if the logger is null. --- .../java/org/apache/maven/cli/MavenCli.java | 7 + .../maven/cli/logging/PrintStreamLogger.java | 187 ------------ .../maven/cli/logging/Slf4jStdoutLogger.java | 284 ++++++++++++++++++ 3 files changed, 291 insertions(+), 187 deletions(-) delete mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/PrintStreamLogger.java create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 772f984494..78b054c0a9 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -40,6 +40,7 @@ import org.apache.maven.Maven; import org.apache.maven.cli.event.DefaultEventSpyContext; import org.apache.maven.cli.event.ExecutionEventLogger; import org.apache.maven.cli.logging.Slf4jLoggerManager; +import org.apache.maven.cli.logging.Slf4jStdoutLogger; import org.apache.maven.cli.transfer.ConsoleMavenTransferListener; import org.apache.maven.cli.transfer.QuietMavenTransferListener; import org.apache.maven.cli.transfer.Slf4jMavenTransferListener; @@ -262,6 +263,12 @@ public class MavenCli private void cli( CliRequest cliRequest ) throws Exception { + // + // Parsing errors can happen during the processing of the arguments and we prefer not having to check if the logger is null + // and make construct this so we can use an SLF4J logger everywhere + // + slf4jLogger = new Slf4jStdoutLogger(); + CLIManager cliManager = new CLIManager(); try diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/PrintStreamLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/PrintStreamLogger.java deleted file mode 100644 index 53025a0daa..0000000000 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/PrintStreamLogger.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.apache.maven.cli.logging; - -/* - * 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.PrintStream; - -import org.apache.maven.Maven; -import org.codehaus.plexus.logging.AbstractLogger; -import org.codehaus.plexus.logging.Logger; - -/** - * Logs to a user-supplied {@link PrintStream}. - * - * @author Benjamin Bentmann - */ -public class PrintStreamLogger - extends AbstractLogger -{ - - public interface Provider - { - PrintStream getStream(); - } - - private Provider provider; - - private static final String FATAL_ERROR = "[FATAL] "; - - private static final String ERROR = "[ERROR] "; - - private static final String WARNING = "[WARNING] "; - - private static final String INFO = "[INFO] "; - - private static final String DEBUG = "[DEBUG] "; - - public PrintStreamLogger( Provider provider ) - { - super( Logger.LEVEL_INFO, Maven.class.getName() ); - - if ( provider == null ) - { - throw new IllegalArgumentException( "output stream provider missing" ); - } - this.provider = provider; - } - - public PrintStreamLogger( PrintStream out ) - { - super( Logger.LEVEL_INFO, Maven.class.getName() ); - - setStream( out ); - } - - public void setStream( final PrintStream out ) - { - if ( out == null ) - { - throw new IllegalArgumentException( "output stream missing" ); - } - - this.provider = new Provider() - { - public PrintStream getStream() - { - return out; - } - }; - } - - public void debug( String message, Throwable throwable ) - { - if ( isDebugEnabled() ) - { - PrintStream out = provider.getStream(); - - out.print( DEBUG ); - out.println( message ); - - if ( null != throwable ) - { - throwable.printStackTrace( out ); - } - } - } - - public void info( String message, Throwable throwable ) - { - if ( isInfoEnabled() ) - { - PrintStream out = provider.getStream(); - - out.print( INFO ); - out.println( message ); - - if ( null != throwable ) - { - throwable.printStackTrace( out ); - } - } - } - - public void warn( String message, Throwable throwable ) - { - if ( isWarnEnabled() ) - { - PrintStream out = provider.getStream(); - - out.print( WARNING ); - out.println( message ); - - if ( null != throwable ) - { - throwable.printStackTrace( out ); - } - } - } - - public void error( String message, Throwable throwable ) - { - if ( isErrorEnabled() ) - { - PrintStream out = provider.getStream(); - - out.print( ERROR ); - out.println( message ); - - if ( null != throwable ) - { - throwable.printStackTrace( out ); - } - } - } - - public void fatalError( String message, Throwable throwable ) - { - if ( isFatalErrorEnabled() ) - { - PrintStream out = provider.getStream(); - - out.print( FATAL_ERROR ); - out.println( message ); - - if ( null != throwable ) - { - throwable.printStackTrace( out ); - } - } - } - - public void close() - { - PrintStream out = provider.getStream(); - - if ( out == System.out || out == System.err ) - { - out.flush(); - } - else - { - out.close(); - } - } - - public Logger getChildLogger( String arg0 ) - { - return this; - } - -} diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java new file mode 100644 index 0000000000..f1a27ae511 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java @@ -0,0 +1,284 @@ +package org.apache.maven.cli.logging; + +import java.io.PrintStream; + +import org.slf4j.Logger; +import org.slf4j.Marker; + +public class Slf4jStdoutLogger + implements Logger +{ + private static final String ERROR = "[ERROR] "; + + private PrintStream out = System.out; + + // + // These are the only methods we need in our primordial logger + // + public void error( String msg ) + { + out.print( ERROR ); + out.println( msg ); + } + + public void error( String msg, Throwable t ) + { + error( msg ); + + if ( null != t ) + { + t.printStackTrace( out ); + } + } + + // + // Don't need any of this + // + public String getName() + { + return null; + } + + public boolean isTraceEnabled() + { + return false; + } + + public void trace( String msg ) + { + } + + public void trace( String format, Object arg ) + { + } + + public void trace( String format, Object arg1, Object arg2 ) + { + } + + public void trace( String format, Object... arguments ) + { + } + + public void trace( String msg, Throwable t ) + { + } + + public boolean isTraceEnabled( Marker marker ) + { + return false; + } + + public void trace( Marker marker, String msg ) + { + } + + public void trace( Marker marker, String format, Object arg ) + { + } + + public void trace( Marker marker, String format, Object arg1, Object arg2 ) + { + } + + public void trace( Marker marker, String format, Object... argArray ) + { + } + + public void trace( Marker marker, String msg, Throwable t ) + { + } + + public boolean isDebugEnabled() + { + return false; + } + + public void debug( String msg ) + { + } + + public void debug( String format, Object arg ) + { + } + + public void debug( String format, Object arg1, Object arg2 ) + { + } + + public void debug( String format, Object... arguments ) + { + } + + public void debug( String msg, Throwable t ) + { + } + + public boolean isDebugEnabled( Marker marker ) + { + return false; + } + + public void debug( Marker marker, String msg ) + { + } + + public void debug( Marker marker, String format, Object arg ) + { + } + + public void debug( Marker marker, String format, Object arg1, Object arg2 ) + { + } + + public void debug( Marker marker, String format, Object... arguments ) + { + } + + public void debug( Marker marker, String msg, Throwable t ) + { + } + + public boolean isInfoEnabled() + { + return false; + } + + public void info( String msg ) + { + } + + public void info( String format, Object arg ) + { + } + + public void info( String format, Object arg1, Object arg2 ) + { + } + + public void info( String format, Object... arguments ) + { + } + + public void info( String msg, Throwable t ) + { + } + + public boolean isInfoEnabled( Marker marker ) + { + return false; + } + + public void info( Marker marker, String msg ) + { + } + + public void info( Marker marker, String format, Object arg ) + { + } + + public void info( Marker marker, String format, Object arg1, Object arg2 ) + { + } + + public void info( Marker marker, String format, Object... arguments ) + { + } + + public void info( Marker marker, String msg, Throwable t ) + { + } + + public boolean isWarnEnabled() + { + return false; + } + + public void warn( String msg ) + { + } + + public void warn( String format, Object arg ) + { + } + + public void warn( String format, Object... arguments ) + { + } + + public void warn( String format, Object arg1, Object arg2 ) + { + } + + public void warn( String msg, Throwable t ) + { + } + + public boolean isWarnEnabled( Marker marker ) + { + return false; + } + + public void warn( Marker marker, String msg ) + { + } + + public void warn( Marker marker, String format, Object arg ) + { + } + + public void warn( Marker marker, String format, Object arg1, Object arg2 ) + { + } + + public void warn( Marker marker, String format, Object... arguments ) + { + } + + public void warn( Marker marker, String msg, Throwable t ) + { + } + + public boolean isErrorEnabled() + { + return false; + } + + public void error( String format, Object arg ) + { + } + + public void error( String format, Object arg1, Object arg2 ) + { + } + + public void error( String format, Object... arguments ) + { + } + + public boolean isErrorEnabled( Marker marker ) + { + return false; + } + + public void error( Marker marker, String msg ) + { + } + + public void error( Marker marker, String format, Object arg ) + { + } + + public void error( Marker marker, String format, Object arg1, Object arg2 ) + { + } + + public void error( Marker marker, String format, Object... arguments ) + { + } + + public void error( Marker marker, String msg, Throwable t ) + { + } + +} From a4c34bfa3fbc4ba96bffddc2464e8a0203819da3 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Fri, 30 Nov 2012 15:13:07 -0800 Subject: [PATCH 011/102] - fix typo --- maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 78b054c0a9..b57a1d4b5e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -265,7 +265,7 @@ public class MavenCli { // // Parsing errors can happen during the processing of the arguments and we prefer not having to check if the logger is null - // and make construct this so we can use an SLF4J logger everywhere + // and construct this so we can use an SLF4J logger everywhere. // slf4jLogger = new Slf4jStdoutLogger(); From fee1640d65561d26b02acdcbf1dff0d108b4f2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 1 Dec 2012 04:27:23 +0100 Subject: [PATCH 012/102] [MNG-5395] don't inject DefaultMavenPluginManager's logger into Mojos but create a dedicated logger with Mojo implementation name --- .../maven/plugin/internal/DefaultMavenPluginManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java index 603e670403..4429f44771 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java @@ -83,6 +83,7 @@ import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.PlexusConfigurationException; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.logging.LoggerManager; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; @@ -110,6 +111,9 @@ public class DefaultMavenPluginManager @Requirement private Logger logger; + @Requirement + private LoggerManager loggerManager; + @Requirement private PlexusContainer container; @@ -508,7 +512,8 @@ public class DefaultMavenPluginManager if ( mojo instanceof Mojo ) { - ( (Mojo) mojo ).setLog( new DefaultLog( logger ) ); + Logger mojoLogger = loggerManager.getLoggerForComponent( mojoDescriptor.getImplementation() ); + ( (Mojo) mojo ).setLog( new DefaultLog( mojoLogger ) ); } Xpp3Dom dom = mojoExecution.getConfiguration(); From aebb64702065e1b161f5fcd24e1b3349b5f75677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 1 Dec 2012 09:14:57 +0100 Subject: [PATCH 013/102] removed unused import --- maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java | 1 - 1 file changed, 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index b57a1d4b5e..0ba7d6bc66 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -56,7 +56,6 @@ import org.apache.maven.execution.MavenExecutionResult; import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder; import org.apache.maven.model.building.ModelProcessor; -import org.apache.maven.plugin.PluginRealmCache; import org.apache.maven.project.MavenProject; import org.apache.maven.properties.internal.EnvironmentUtils; import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; From 1062524b39952e040b2fe7f0073ce4c4d3a00630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 1 Dec 2012 09:35:12 +0100 Subject: [PATCH 014/102] [MNG-5396] changed logger name for execution events and batch transfer (was MavenCli) this shows some logging patterns we should discuss about and document our conventions --- .../src/main/java/org/apache/maven/cli/MavenCli.java | 4 ++-- .../org/apache/maven/cli/event/ExecutionEventLogger.java | 9 ++++++++- .../maven/cli/transfer/Slf4jMavenTransferListener.java | 9 ++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 0ba7d6bc66..81d520b65d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -894,7 +894,7 @@ public class MavenCli transferListener = getBatchTransferListener(); } - ExecutionListener executionListener = new ExecutionEventLogger( slf4jLogger ); + ExecutionListener executionListener = new ExecutionEventLogger(); executionListener = eventSpyDispatcher.chainListener( executionListener ); String alternatePomFile = null; @@ -1160,7 +1160,7 @@ public class MavenCli protected TransferListener getBatchTransferListener() { - return new Slf4jMavenTransferListener( slf4jLogger ); + return new Slf4jMavenTransferListener(); } protected void customizeContainer( PlexusContainer container ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java index 819f179e12..f55141d4c3 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java @@ -31,9 +31,10 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.MavenProject; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * Logs execution events to a user-supplied logger. + * Logs execution events to logger, eventually user-supplied. * * @author Benjamin Bentmann */ @@ -44,6 +45,12 @@ public class ExecutionEventLogger private static final int LINE_LENGTH = 72; + public ExecutionEventLogger() + { + logger = LoggerFactory.getLogger( ExecutionEventLogger.class ); + } + + // TODO should we deprecate? public ExecutionEventLogger( Logger logger ) { if ( logger == null ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java index 27ff90d464..f09c768959 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java @@ -24,6 +24,7 @@ import java.text.DecimalFormatSymbols; import java.util.Locale; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonatype.aether.transfer.AbstractTransferListener; import org.sonatype.aether.transfer.TransferCancelledException; import org.sonatype.aether.transfer.TransferEvent; @@ -33,8 +34,14 @@ public class Slf4jMavenTransferListener extends AbstractTransferListener { - protected Logger out; + protected final Logger out; + public Slf4jMavenTransferListener() + { + this.out = LoggerFactory.getLogger( Slf4jMavenTransferListener.class ); + } + + // TODO should we deprecate? public Slf4jMavenTransferListener( Logger out ) { this.out = out; From 1a1fe6d50802713d969ed08d6fa06dec53cf90e9 Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Sat, 1 Dec 2012 10:53:45 +0100 Subject: [PATCH 015/102] o Made lower bound of executor threads 0 for artifact resolver Ideally I think we should just get rid of the whole executor and use new Thread() instead, which would mean we'd need some way of constraining thread counts. Freeing the threads mean they also release the classloader --- .../apache/maven/artifact/resolver/DefaultArtifactResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index e75c61d603..2b978b0b44 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -111,7 +111,7 @@ public class DefaultArtifactResolver else { executor = - new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DaemonThreadCreator()); + new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DaemonThreadCreator()); } } From 86004d6022958e19ddafeb99766b7babdafd5567 Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Sat, 1 Dec 2012 11:16:17 +0100 Subject: [PATCH 016/102] o Classworlds 2.4.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7c53729fda..bfb4792fa9 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ 2001 - 2.4.1 + 2.4.2 1.2 1.2_Java1.3 3.8.2 From af70de4b967bbc352bed1e57491f66c2f4723530 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 1 Dec 2012 12:24:39 +0100 Subject: [PATCH 017/102] fix scm informations --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index bfb4792fa9..c97b7f317b 100644 --- a/pom.xml +++ b/pom.xml @@ -84,9 +84,9 @@ - scm:svn:http://svn.apache.org/repos/asf/maven/maven-3/trunk - scm:svn:https://svn.apache.org/repos/asf/maven/maven-3/trunk - http://svn.apache.org/viewvc/maven/maven-3/trunk + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + https://git-wip-us.apache.org/repos/asf?p=maven.git jira From df162a5a359f195d2db39b9a3890fc4af0c14ae6 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Sat, 1 Dec 2012 23:20:55 +0100 Subject: [PATCH 018/102] [MNG-5398] scriptSourceDirectory in superpom is not prefixed with ${project.basedir}/ --- .../src/main/resources/org/apache/maven/model/pom-4.0.0.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml index 1e70e8a016..47d17e5bc7 100644 --- a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml +++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml @@ -56,7 +56,7 @@ under the License. ${project.artifactId}-${project.version} ${project.build.directory}/test-classes ${project.basedir}/src/main/java - src/main/scripts + ${project.build.directory}/src/main/scripts ${project.basedir}/src/test/java From e052ebaa7ba6d6d8858fe9eb4571479e977e8fc1 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Sat, 1 Dec 2012 23:22:28 +0100 Subject: [PATCH 019/102] [MNG-5399] Upgrade version of maven-release-plugin in superpom --- .../src/main/resources/org/apache/maven/model/pom-4.0.0.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml index 47d17e5bc7..931f87b32f 100644 --- a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml +++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml @@ -86,7 +86,7 @@ under the License. maven-release-plugin - 2.0 + 2.3.2 From dbef526ede1e6b77d156e2b1f1b9dee377cd4cb9 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Sat, 1 Dec 2012 23:55:16 +0100 Subject: [PATCH 020/102] [MNG-5398] scriptSourceDirectory in superpom is not prefixed with ${project.basedir}/ (now with the right expression) --- .../src/main/resources/org/apache/maven/model/pom-4.0.0.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml index 931f87b32f..f1f8a2a104 100644 --- a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml +++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml @@ -56,7 +56,7 @@ under the License. ${project.artifactId}-${project.version} ${project.build.directory}/test-classes ${project.basedir}/src/main/java - ${project.build.directory}/src/main/scripts + ${project.basedir}/src/main/scripts ${project.basedir}/src/test/java From 327e1b7e80f9157d2fb99736d4dc1f2d8b3648ae Mon Sep 17 00:00:00 2001 From: rfscholte Date: Sun, 2 Dec 2012 00:02:13 +0100 Subject: [PATCH 021/102] [MNG-5400] Upgrade version of maven-dependency-plugin in superpom to 2.5 --- .../src/main/resources/org/apache/maven/model/pom-4.0.0.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml index f1f8a2a104..3501f39063 100644 --- a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml +++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml @@ -82,7 +82,7 @@ under the License. maven-dependency-plugin - 2.1 + 2.5 maven-release-plugin From 75ea1e42975b780cf57962b4d377c60ccdd634ea Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Sat, 1 Dec 2012 21:30:57 +0100 Subject: [PATCH 022/102] [MNG-5208] Parallel (-T option) multi module build fires wrong project failed event Patch by Stefan Eder , applied with minor modifications --- .../maven/lifecycle/internal/BuilderCommon.java | 11 +++++------ .../lifecycle/internal/LifecycleModuleBuilder.java | 4 ++-- .../lifecycle/internal/LifecycleWeaveBuilder.java | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java index 2e63647487..a0187378b6 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java @@ -48,7 +48,7 @@ import java.util.Set; /** * Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder - * + * * @since 3.0 * @author Kristian Rosenvold * Builds one or more lifecycles for a full module @@ -133,9 +133,8 @@ public class BuilderCommon return executionPlan; } - public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession, - final MavenProject mavenProject, Exception e, final long buildStartTime ) - { + public void handleBuildError(final ReactorContext buildContext, final MavenSession rootSession, final MavenSession currentSession, + final MavenProject mavenProject, Exception e, final long buildStartTime) { if ( e instanceof RuntimeException ) { e = new InternalErrorException( "Internal error: " + e, e ); @@ -147,7 +146,7 @@ public class BuilderCommon buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) ); - eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, rootSession, null, e ); + eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, currentSession, null, e ); if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) ) { @@ -187,4 +186,4 @@ public class BuilderCommon } -} \ No newline at end of file +} diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java index fe69c0a120..a0056b42a9 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java @@ -32,7 +32,7 @@ import java.util.HashSet; /** * Builds one or more lifecycles for a full module - * + * * @since 3.0 * @author Benjamin Bentmann * @author Jason van Zyl @@ -92,7 +92,7 @@ public class LifecycleModuleBuilder } catch ( Exception e ) { - builderCommon.handleBuildError( reactorContext, rootSession, currentProject, e, buildStartTime ); + builderCommon.handleBuildError(reactorContext, rootSession, session, currentProject, e, buildStartTime); } finally { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java index 12058e5307..4b267282fe 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java @@ -277,8 +277,8 @@ public class LifecycleWeaveBuilder } catch ( Exception e ) { - builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getProject(), e, - buildStartTime ); + builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getSession(), + projectBuild.getProject(), e, buildStartTime ); } finally { From ab86435af10a9b7dfe2f13daacc978d535f818a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 2 Dec 2012 11:21:57 +0100 Subject: [PATCH 023/102] stay with fluido skin 1.2.1 because of MSKINS-69 --- src/site/site.xml | 146 +++++++++++++++++++++++----------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index 291d8ced9f..fb96718f68 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -1,74 +1,74 @@ - - - - - - - - ${project.name} - http://maven.apache.org/images/apache-maven-project.png - http://maven.apache.org/ - - - http://maven.apache.org/images/maventxt_logo_200.gif - - - - org.apache.maven.skins - maven-fluido-skin - 1.3.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + ${project.name} + http://maven.apache.org/images/apache-maven-project.png + http://maven.apache.org/ + + + http://maven.apache.org/images/maventxt_logo_200.gif + + + + org.apache.maven.skins + maven-fluido-skin + 1.2.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 71a8427df6286955c17ce1d6701804896c2b7ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 2 Dec 2012 12:38:12 +0100 Subject: [PATCH 024/102] code formatting --- .../maven/lifecycle/internal/BuilderCommon.java | 7 ++++--- .../lifecycle/internal/LifecycleModuleBuilder.java | 4 ++-- .../lifecycle/internal/LifecycleWeaveBuilder.java | 11 +++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java index a0187378b6..2c228ba645 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java @@ -133,8 +133,10 @@ public class BuilderCommon return executionPlan; } - public void handleBuildError(final ReactorContext buildContext, final MavenSession rootSession, final MavenSession currentSession, - final MavenProject mavenProject, Exception e, final long buildStartTime) { + public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession, + final MavenSession currentSession, final MavenProject mavenProject, Exception e, + final long buildStartTime ) + { if ( e instanceof RuntimeException ) { e = new InternalErrorException( "Internal error: " + e, e ); @@ -185,5 +187,4 @@ public class BuilderCommon return project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion(); } - } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java index a0056b42a9..c8a3cf4a2d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java @@ -92,7 +92,7 @@ public class LifecycleModuleBuilder } catch ( Exception e ) { - builderCommon.handleBuildError(reactorContext, rootSession, session, currentProject, e, buildStartTime); + builderCommon.handleBuildError( reactorContext, rootSession, session, currentProject, e, buildStartTime ); } finally { @@ -101,4 +101,4 @@ public class LifecycleModuleBuilder Thread.currentThread().setContextClassLoader( reactorContext.getOriginalContextClassLoader() ); } } -} \ No newline at end of file +} diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java index 4b267282fe..9447480817 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java @@ -375,13 +375,14 @@ public class LifecycleWeaveBuilder return null; } - private static boolean isThreadLockedAndEmpty(Artifact artifact){ - return artifact instanceof ThreadLockedArtifact && !((ThreadLockedArtifact) artifact).hasReal(); + private static boolean isThreadLockedAndEmpty( Artifact artifact ) + { + return artifact instanceof ThreadLockedArtifact && !( (ThreadLockedArtifact) artifact ).hasReal(); } private static Artifact findDependency( MavenProject project, Artifact upStreamArtifact ) { - if ( upStreamArtifact == null || isThreadLockedAndEmpty(upStreamArtifact)) + if ( upStreamArtifact == null || isThreadLockedAndEmpty( upStreamArtifact ) ) { return null; } @@ -483,8 +484,6 @@ public class LifecycleWeaveBuilder artifactInThis.setFile( upstream.getFile() ); artifactInThis.setRepository( upstream.getRepository() ); artifactInThis.setResolved( true ); // Or maybe upstream.isResolved().... - } } - -} \ No newline at end of file +} From 543870467f11597d815ba9fbce48b5b21be22983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 2 Dec 2012 20:22:52 +0100 Subject: [PATCH 025/102] fixed errors reported by Checkstyle --- .../repository/ArtifactRepositoryPolicy.java | 1 - .../versioning/ComparableVersion.java | 18 ++-- .../versioning/DefaultArtifactVersion.java | 2 +- .../maven/artifact/ArtifactScopeEnum.java | 2 +- .../DefaultRepositoryMetadataManager.java | 30 +++--- .../repository/metadata/MetadataBridge.java | 1 - .../resolver/DefaultArtifactResolver.java | 97 ++++++++++++------- .../AbstractStringBasedModelInterpolator.java | 6 +- .../validation/DefaultModelValidator.java | 4 - .../maven/repository/MetadataGraphNode.java | 4 +- .../DefaultArtifactRepositoryFactory.java | 2 +- .../DefaultLegacyArtifactCollector.java | 4 +- .../repository/metadata/ArtifactMetadata.java | 16 +-- .../repository/metadata/MetadataGraph.java | 2 +- .../metadata/MetadataGraphEdge.java | 10 +- .../metadata/MetadataResolution.java | 2 +- .../project/DefaultModelBuildingListener.java | 16 +-- .../apache/maven/project/MavenProject.java | 30 +++--- .../maven/project/ProjectBuildingRequest.java | 2 +- .../maven/repository/RepositorySystem.java | 12 +-- .../apache/maven/cli/CLIReportingUtils.java | 12 ++- .../java/org/apache/maven/cli/MavenCli.java | 2 +- 22 files changed, 157 insertions(+), 118 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java index 306c90b965..f76e2c1377 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java @@ -21,7 +21,6 @@ package org.apache.maven.artifact.repository; import java.util.Calendar; import java.util.Date; -import java.util.TimeZone; /** * Describes a set of policies for a repository to use under certain conditions. diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java index da654c8492..481e845d87 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java @@ -69,9 +69,9 @@ public class ComparableVersion private interface Item { - final int INTEGER_ITEM = 0; - final int STRING_ITEM = 1; - final int LIST_ITEM = 2; + int INTEGER_ITEM = 0; + int STRING_ITEM = 1; + int LIST_ITEM = 2; int compareTo( Item item ); @@ -86,7 +86,7 @@ public class ComparableVersion private static class IntegerItem implements Item { - private static final BigInteger BigInteger_ZERO = new BigInteger( "0" ); + private static final BigInteger BIG_INTEGER_ZERO = new BigInteger( "0" ); private final BigInteger value; @@ -94,7 +94,7 @@ public class ComparableVersion private IntegerItem() { - this.value = BigInteger_ZERO; + this.value = BIG_INTEGER_ZERO; } public IntegerItem( String str ) @@ -109,14 +109,14 @@ public class ComparableVersion public boolean isNull() { - return BigInteger_ZERO.equals( value ); + return BIG_INTEGER_ZERO.equals( value ); } public int compareTo( Item item ) { if ( item == null ) { - return BigInteger_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1 + return BIG_INTEGER_ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1 } switch ( item.getType() ) @@ -266,7 +266,7 @@ public class ComparableVersion void normalize() { - for( ListIterator iterator = listIterator( size() ); iterator.hasPrevious(); ) + for ( ListIterator iterator = listIterator( size() ); iterator.hasPrevious(); ) { Item item = iterator.previous(); if ( item.isNull() ) @@ -327,7 +327,7 @@ public class ComparableVersion public String toString() { StringBuilder buffer = new StringBuilder( "(" ); - for( Iterator iter = iterator(); iter.hasNext(); ) + for ( Iterator iter = iterator(); iter.hasNext(); ) { buffer.append( iter.next() ); if ( iter.hasNext() ) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java index b588340937..db71dc700c 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java @@ -72,7 +72,7 @@ public class DefaultArtifactVersion { if ( otherVersion instanceof DefaultArtifactVersion ) { - return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion).comparable ); + return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion ).comparable ); } else { diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java index 574f7d6d55..c6d02c6fde 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java @@ -108,7 +108,7 @@ public enum ArtifactScopeEnum { final ArtifactScopeEnum s = checkScope( scope ); - // system scope is historic only - and simple + // system scope is historic only - and simple if ( id == system.id ) { return scope.id == system.id; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index 0f1030b2e6..cbdcf07bee 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -1,18 +1,22 @@ package org.apache.maven.artifact.repository.metadata; /* - * 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. + * 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; @@ -47,7 +51,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * @author Jason van Zyl */ -@Component(role=RepositoryMetadataManager.class) +@Component( role = RepositoryMetadataManager.class ) public class DefaultRepositoryMetadataManager extends AbstractLogEnabled implements RepositoryMetadataManager diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java index a1fb1e8426..8024d310b1 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java @@ -24,7 +24,6 @@ import java.io.File; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; import org.codehaus.plexus.util.FileUtils; import org.sonatype.aether.RepositoryException; import org.sonatype.aether.metadata.MergeableMetadata; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 2b978b0b44..18deeb2f5e 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -1,18 +1,22 @@ package org.apache.maven.artifact.resolver; /* - * 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. + * 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; @@ -65,7 +69,7 @@ import org.sonatype.aether.resolution.ArtifactResult; /** * @author Jason van Zyl */ -@Component(role = ArtifactResolver.class) +@Component( role = ArtifactResolver.class ) public class DefaultArtifactResolver implements ArtifactResolver { @@ -111,7 +115,8 @@ public class DefaultArtifactResolver else { executor = - new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DaemonThreadCreator()); + new ThreadPoolExecutor( 0, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue(), + new DaemonThreadCreator() ); } } @@ -151,19 +156,22 @@ public class DefaultArtifactResolver } } - public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, TransferListener resolutionListener ) + public void resolve( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository, TransferListener resolutionListener ) throws ArtifactResolutionException, ArtifactNotFoundException { resolve( artifact, remoteRepositories, getSession( localRepository ) ); } - public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolveAlways( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { resolve( artifact, remoteRepositories, getSession( localRepository ) ); } - private void resolve( Artifact artifact, List remoteRepositories, RepositorySystemSession session ) + private void resolve( Artifact artifact, List remoteRepositories, + RepositorySystemSession session ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( artifact == null ) @@ -249,52 +257,73 @@ public class DefaultArtifactResolver } } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List remoteRepositories, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter ); + return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, + remoteRepositories, source, filter ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, - ArtifactMetadataSource source, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, + ArtifactMetadataSource source, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, null, listeners ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, listeners, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, List conflictResolvers ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -336,7 +365,7 @@ public class DefaultArtifactResolver { Artifact rootArtifact = request.getArtifact(); Set artifacts = request.getArtifactDependencies(); - Map managedVersions = request.getManagedVersionMap(); + Map managedVersions = request.getManagedVersionMap(); List listeners = request.getListeners(); ArtifactFilter collectionFilter = request.getCollectionFilter(); ArtifactFilter resolutionFilter = request.getResolutionFilter(); diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java index aff88e0a03..f4a1b5c41a 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java @@ -283,7 +283,7 @@ public abstract class AbstractStringBasedModelInterpolator pathTranslator ) ); } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) protected String interpolateInternal( String src, List valueSources, List postProcessors, boolean debug ) throws ModelInterpolationException @@ -296,7 +296,7 @@ public abstract class AbstractStringBasedModelInterpolator Logger logger = getLogger(); String result = src; - synchronized( this ) + synchronized ( this ) { for ( ValueSource vs : valueSources ) @@ -315,7 +315,7 @@ public abstract class AbstractStringBasedModelInterpolator { result = interpolator.interpolate( result, recursionInterceptor ); } - catch( InterpolationException e ) + catch ( InterpolationException e ) { throw new ModelInterpolationException( e.getMessage(), e ); } diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java index a6782d69f0..0095f80382 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java @@ -19,15 +19,11 @@ package org.apache.maven.project.validation; * under the License. */ -import java.util.List; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Model; import org.apache.maven.model.building.DefaultModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblem.Version; import org.apache.maven.model.building.ModelProblemCollectorRequest; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java index 3940cf336d..22394e7078 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java @@ -41,8 +41,8 @@ public class MetadataGraphNode public MetadataGraphNode() { - inNodes = new ArrayList(4); - exNodes = new ArrayList(8); + inNodes = new ArrayList( 4 ); + exNodes = new ArrayList( 8 ); } public MetadataGraphNode( MavenArtifactMetadata metadata ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java index 85a6bc45da..4bc911673d 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java @@ -43,7 +43,7 @@ public class DefaultArtifactRepositoryFactory private String globalChecksumPolicy; @Requirement( role = ArtifactRepositoryLayout.class ) - private Map repositoryLayouts; + private Map repositoryLayouts; public ArtifactRepositoryLayout getLayout( String layoutId ) throws UnknownRepositoryLayoutException diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java index 651d46e8ce..d69e8125f8 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -63,10 +63,10 @@ import org.codehaus.plexus.logging.Logger; public class DefaultLegacyArtifactCollector implements LegacyArtifactCollector { - @Requirement(hint="nearest") + @Requirement( hint = "nearest" ) private ConflictResolver defaultConflictResolver; - @Requirement + @Requirement private Logger logger; @Requirement diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java index 00749470d5..2666eafb62 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -28,7 +28,6 @@ import org.apache.maven.artifact.ArtifactScopeEnum; * Artifact Metadata that is resolved independent of Artifact itself. * * @author Oleg Gusakov - * */ public class ArtifactMetadata { @@ -291,7 +290,7 @@ public class ArtifactMetadata return artifactExists; } - public void setArtifactExists(boolean artifactExists) + public void setArtifactExists( boolean artifactExists ) { this.artifactExists = artifactExists; } @@ -302,7 +301,7 @@ public class ArtifactMetadata return dependencies; } - public void setDependencies(Collection dependencies) + public void setDependencies( Collection dependencies ) { this.dependencies = dependencies; } @@ -312,7 +311,7 @@ public class ArtifactMetadata return artifactUri; } - public void setArtifactUri(String artifactUri) + public void setArtifactUri( String artifactUri ) { this.artifactUri = artifactUri; } @@ -322,23 +321,28 @@ public class ArtifactMetadata { return why; } - public void setWhy(String why) + + public void setWhy( String why ) { this.why = why; } + //------------------------------------------------------------------- public String getError() { return error; } - public void setError(String error) + + public void setError( String error ) { this.error = error; } + public boolean isError() { return error == null; } + //------------------------------------------------------------------ public String getDependencyConflictId() { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java index d898739275..b116c69f06 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -294,7 +294,7 @@ public class MetadataGraph //------------------------------------------------------------------------ public List getEdgesBetween( MetadataGraphVertex vFrom, MetadataGraphVertex vTo ) { - List edges = getIncidentEdges(vTo); + List edges = getIncidentEdges( vTo ); if ( edges == null || edges.isEmpty() ) { return null; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java index 4a50b207b7..9d86933ab2 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -125,10 +125,10 @@ public class MetadataGraphEdge this.depth = depth; } - public boolean isResolved() - { - return resolved; - } + public boolean isResolved() + { + return resolved; + } public void setResolved( boolean resolved ) { @@ -175,7 +175,7 @@ public class MetadataGraphEdge this.target = target; } - @Override + @Override public String toString() { return "[ " + "FROM:(" diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java index 770ae79d2f..9a9130b2fa 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java @@ -62,7 +62,7 @@ public class MetadataResolution return artifactMetadata; } - public void setArtifactMetadata(ArtifactMetadata artifactMetadata) + public void setArtifactMetadata( ArtifactMetadata artifactMetadata ) { this.artifactMetadata = artifactMetadata; } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java index 30423ce4ab..ca2663845b 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java @@ -97,9 +97,9 @@ class DefaultModelBuildingListener } catch ( Exception e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid plugin repository: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } project.setPluginArtifactRepositories( pluginRepositories ); @@ -115,15 +115,15 @@ class DefaultModelBuildingListener } catch ( PluginResolutionException e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Unresolveable build extension: " + e.getMessage()) - .setException( e )); + .setException( e ) ); } catch ( PluginVersionResolutionException e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Unresolveable build extension: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } projectBuildingHelper.selectProjectRealm( project ); @@ -138,9 +138,9 @@ class DefaultModelBuildingListener } catch ( Exception e ) { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Invalid artifact repository: " + e.getMessage() ) - .setException( e )); + .setException( e ) ); } project.setRemoteArtifactRepositories( remoteRepositories ); } diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index 5090c3e4f7..0349e8aa86 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -1,18 +1,22 @@ package org.apache.maven.project; /* - * 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. + * 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.RepositoryUtils; @@ -1477,7 +1481,7 @@ public class MavenProject for ( int ax = 0; ax < attachedArtifacts.size(); ax++ ) { Artifact a = attachedArtifacts.get( ax ); - if ( a.equals( artifact )) + if ( a.equals( artifact ) ) { if ( logger != null ) { diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java index 39522f6843..db8fe902fa 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java @@ -79,7 +79,7 @@ public interface ProjectBuildingRequest */ Properties getUserProperties(); - void setProject(MavenProject mavenProject); + void setProject( MavenProject mavenProject ); MavenProject getProject(); diff --git a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java index 147b7cf8ef..7bcd442539 100644 --- a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java +++ b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java @@ -42,17 +42,17 @@ import org.sonatype.aether.RepositorySystemSession; */ public interface RepositorySystem { - final String DEFAULT_LOCAL_REPO_ID = "local"; + String DEFAULT_LOCAL_REPO_ID = "local"; - final String userHome = System.getProperty( "user.home" ); + String userHome = System.getProperty( "user.home" ); - final File userMavenConfigurationHome = new File( userHome, ".m2" ); + File userMavenConfigurationHome = new File( userHome, ".m2" ); - final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); + File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); - final String DEFAULT_REMOTE_REPO_ID = "central"; + String DEFAULT_REMOTE_REPO_ID = "central"; - final String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2"; + String DEFAULT_REMOTE_REPO_URL = "http://repo.maven.apache.org/maven2"; Artifact createArtifact( String groupId, String artifactId, String version, String packaging ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java index 0f8262b102..8f1ae8e163 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java @@ -53,11 +53,15 @@ public final class CLIReportingUtils Properties properties = getBuildProperties(); StringBuffer version = new StringBuffer(); version.append( createMavenVersionString( properties ) ).append( LS ); - version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " + System.getProperty( "maven.home", "" ) ) ).append( LS ); - version.append( "Java version: " + System.getProperty( "java.version", "" ) + ", vendor: " + System.getProperty( "java.vendor", "" ) ).append( LS ); + version.append( reduce( properties.getProperty( "distributionShortName" ) + " home: " + + System.getProperty( "maven.home", "" ) ) ).append( LS ); + version.append( "Java version: " + System.getProperty( "java.version", "" ) + + ", vendor: " + System.getProperty( "java.vendor", "" ) ).append( LS ); version.append( "Java home: " + System.getProperty( "java.home", "" ) ).append( LS ); - version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: " + System.getProperty( "file.encoding", "" ) ).append( LS ); - version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH + "\", family: \"" + Os.OS_FAMILY + "\"" ); + version.append( "Default locale: " + Locale.getDefault() + ", platform encoding: " + + System.getProperty( "file.encoding", "" ) ).append( LS ); + version.append( "OS name: \"" + Os.OS_NAME + "\", version: \"" + Os.OS_VERSION + "\", arch: \"" + Os.OS_ARCH + + "\", family: \"" + Os.OS_FAMILY + "\"" ); return version.toString(); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 81d520b65d..e744e65ed3 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -233,7 +233,7 @@ public class MavenCli } finally { - if (localContainer != null) + if ( localContainer != null ) { localContainer.dispose(); } From b63904c9db0e6760d8f0f52488242272a70b7d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 3 Dec 2012 02:21:58 +0100 Subject: [PATCH 026/102] fixed errors reported by Checkstyle (once again...) --- .../maven/profiles/DefaultProfileManager.java | 5 - .../SystemPropertyProfileActivator.java | 2 +- .../internal/LifecycleDependencyResolver.java | 37 +++-- .../internal/ThreadLockedArtifact.java | 10 +- .../DefaultLifecycleBindingsInjector.java | 4 +- .../maven/plugin/BuildPluginManager.java | 28 ++-- .../plugin/DefaultBuildPluginManager.java | 30 ++-- .../plugin/internal/DefaultLegacySupport.java | 14 +- .../internal/PluginDependenciesResolver.java | 2 +- .../plugin/prefix/PluginPrefixResult.java | 6 +- .../project/DefaultModelBuildingListener.java | 2 +- .../maven/project/DefaultProjectBuilder.java | 28 ++-- .../model/building/DefaultModelBuilder.java | 128 ++++++++++-------- .../model/building/DefaultModelProblem.java | 3 +- .../DefaultModelProblemCollector.java | 7 +- .../maven/model/building/ModelProblem.java | 3 +- .../model/building/ModelProblemCollector.java | 3 - .../ModelProblemCollectorRequest.java | 50 +++---- .../AbstractStringBasedModelInterpolator.java | 4 +- .../ProblemDetectingValueSource.java | 3 +- .../StringSearchModelInterpolator.java | 10 +- .../plugin/DefaultReportingConverter.java | 6 +- .../model/profile/DefaultProfileSelector.java | 8 +- .../JdkVersionProfileActivator.java | 2 +- .../validation/DefaultModelValidator.java | 10 +- 25 files changed, 218 insertions(+), 187 deletions(-) diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java index ae3d2c51c1..740c2cd93a 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java @@ -20,13 +20,10 @@ package org.apache.maven.profiles; */ import org.apache.maven.model.Activation; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Profile; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblem.Severity; import org.apache.maven.model.profile.DefaultProfileActivationContext; -import org.apache.maven.model.profile.ProfileActivationContext; import org.apache.maven.model.profile.ProfileSelector; import org.apache.maven.profiles.activation.ProfileActivationException; import org.codehaus.plexus.MutablePlexusContainer; @@ -36,13 +33,11 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti import org.codehaus.plexus.logging.Logger; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; -import org.apache.maven.model.building.ModelProblem.Version; import org.apache.maven.model.building.ModelProblemCollectorRequest; @Deprecated diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java index 4186415418..a03267dc2d 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java @@ -63,7 +63,7 @@ public class SystemPropertyProfileActivator + profile.getId() + "'" ); } - if ( name.startsWith("!") ) + if ( name.startsWith( "!" ) ) { reverseName = true; name = name.substring( 1 ); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java index a549ce2b33..075283d3dc 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java @@ -1,20 +1,33 @@ package org.apache.maven.lifecycle.internal; /* - * 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 + * 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 + * 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. + * 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.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; @@ -37,8 +50,6 @@ import org.sonatype.aether.graph.DependencyNode; import org.sonatype.aether.util.filter.AndDependencyFilter; import org.sonatype.aether.util.filter.ScopeDependencyFilter; -import java.util.*; - /** * Resolves dependencies for the artifacts in context of the lifecycle build * @@ -49,7 +60,7 @@ import java.util.*; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecycleDependencyResolver.class) +@Component( role = LifecycleDependencyResolver.class ) public class LifecycleDependencyResolver { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadLockedArtifact.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadLockedArtifact.java index b566e641d8..9c6cf40119 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadLockedArtifact.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadLockedArtifact.java @@ -52,8 +52,8 @@ class ThreadLockedArtifact public boolean hasReal() { - return real != null && - ( !( real instanceof ThreadLockedArtifact ) || ( (ThreadLockedArtifact) real ).hasReal() ); + return real != null + && ( !( real instanceof ThreadLockedArtifact ) || ( (ThreadLockedArtifact) real ).hasReal() ); } public String getGroupId() @@ -96,17 +96,17 @@ class ThreadLockedArtifact return real.hasClassifier(); } - private static final InheritableThreadLocal threadArtifact = + private static final InheritableThreadLocal THREAD_ARTIFACT = new InheritableThreadLocal(); public void attachToThread() { - threadArtifact.set( this ); + THREAD_ARTIFACT.set( this ); } public File getFile() { - final ThreadLockedArtifact lockedArtifact = threadArtifact.get(); + final ThreadLockedArtifact lockedArtifact = THREAD_ARTIFACT.get(); if ( lockedArtifact != null && this != lockedArtifact && mustLock() ) { try diff --git a/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java b/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java index d2486b480f..5cb33637e5 100644 --- a/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java +++ b/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java @@ -66,9 +66,9 @@ public class DefaultLifecycleBindingsInjector if ( defaultPlugins == null ) { - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Unknown packaging: " + packaging ) - .setLocation( model.getLocation( "packaging" ))); + .setLocation( model.getLocation( "packaging" ) ) ); } else if ( !defaultPlugins.isEmpty() ) { diff --git a/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java index 48eed40bde..5e93bcebde 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java @@ -1,18 +1,22 @@ package org.apache.maven.plugin; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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.util.List; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java index 3ae2c58cc5..fee2eb0eac 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java @@ -1,18 +1,22 @@ package org.apache.maven.plugin; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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.ByteArrayOutputStream; @@ -33,7 +37,7 @@ import org.sonatype.aether.repository.RemoteRepository; // TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works // TODO: remove the coreArtifactFilterManager -@Component(role = BuildPluginManager.class) +@Component( role = BuildPluginManager.class ) public class DefaultBuildPluginManager implements BuildPluginManager { diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java index 78790d7956..a71a0007a5 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java @@ -39,29 +39,29 @@ public class DefaultLegacySupport implements LegacySupport { - private static final ThreadLocal> session = new InheritableThreadLocal>(); + private static final ThreadLocal> SESSION = new InheritableThreadLocal>(); public void setSession( MavenSession session ) { - AtomicReference reference = DefaultLegacySupport.session.get(); + AtomicReference reference = DefaultLegacySupport.SESSION.get(); if ( reference != null ) { - reference.set( null); + reference.set( null ); } - if ( session == null && reference != null) + if ( session == null && reference != null ) { - DefaultLegacySupport.session.remove(); + DefaultLegacySupport.SESSION.remove(); } else { - DefaultLegacySupport.session.set( new AtomicReference( session )); + DefaultLegacySupport.SESSION.set( new AtomicReference( session ) ); } } public MavenSession getSession() { - AtomicReference currentSession = DefaultLegacySupport.session.get(); + AtomicReference currentSession = DefaultLegacySupport.SESSION.get(); return currentSession != null ? currentSession.get() : null; } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java index 1aa578eddb..60d83141a1 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java @@ -50,7 +50,7 @@ public interface PluginDependenciesResolver * @return The resolved plugin artifact, never {@code null}. * @throws PluginResolutionException If the plugin artifact could not be resolved. */ - public Artifact resolve( Plugin plugin, List repositories, RepositorySystemSession session ) + Artifact resolve( Plugin plugin, List repositories, RepositorySystemSession session ) throws PluginResolutionException; /** diff --git a/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java b/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java index f21b6701d8..0e67f37bea 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java @@ -1,7 +1,5 @@ package org.apache.maven.plugin.prefix; -import org.sonatype.aether.repository.ArtifactRepository; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -11,7 +9,7 @@ import org.sonatype.aether.repository.ArtifactRepository; * "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 + * 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 @@ -21,6 +19,8 @@ import org.sonatype.aether.repository.ArtifactRepository; * under the License. */ +import org.sonatype.aether.repository.ArtifactRepository; + /** * Describes the result of a plugin prefix resolution request. * diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java index ca2663845b..3aebe9b4b7 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java @@ -116,7 +116,7 @@ class DefaultModelBuildingListener catch ( PluginResolutionException e ) { event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Unresolveable build extension: " + e.getMessage()) + .setMessage( "Unresolveable build extension: " + e.getMessage() ) .setException( e ) ); } catch ( PluginVersionResolutionException e ) diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index 4e4db80d4b..a242ee579c 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -1,18 +1,22 @@ package org.apache.maven.project; /* - * 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. + * 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; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index e075f7b0e6..90a20eb0ec 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -317,7 +317,7 @@ public class DefaultModelBuilder } message += currentData.getId(); - problems.add( new ModelProblemCollectorRequest(ModelProblem.Severity.FATAL, ModelProblem.Version.BASE).setMessage(message)); + problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL, ModelProblem.Version.BASE ).setMessage( message ) ); throw problems.newModelBuildingException(); } } @@ -409,7 +409,7 @@ public class DefaultModelBuilder modelValidator.validateEffectiveModel( resultModel, request, problems ); - if ( hasModelErrors(problems) ) + if ( hasModelErrors( problems ) ) { throw problems.newModelBuildingException(); } @@ -471,15 +471,15 @@ public class DefaultModelBuilder if ( pomFile != null ) { - problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.V20) - .setMessage("Malformed POM " + modelSource.getLocation() + ": " + e.getMessage()) - .setException(e )); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 ) + .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) + .setException( e ) ); } else { - problems.add( new ModelProblemCollectorRequest(Severity.WARNING, Version.V20) - .setMessage("Malformed POM " + modelSource.getLocation() + ": " + e.getMessage()) - .setException(e)); + problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ) + .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ) + .setException( e ) ); } } @@ -491,9 +491,9 @@ public class DefaultModelBuilder } catch ( ModelParseException e ) { - problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE) - .setMessage("Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage()) - .setException(e)); + problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ) + .setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() ) + .setException( e ) ); throw problems.newModelBuildingException(); } catch ( IOException e ) @@ -511,9 +511,9 @@ public class DefaultModelBuilder msg = e.getClass().getSimpleName(); } } - problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE) - .setMessage("Non-readable POM " + modelSource.getLocation() + ": " + msg) - .setException(e )); + problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ) + .setMessage( "Non-readable POM " + modelSource.getLocation() + ": " + msg ) + .setException( e ) ); throw problems.newModelBuildingException(); } @@ -522,7 +522,7 @@ public class DefaultModelBuilder problems.setSource( model ); modelValidator.validateRawModel( model, request, problems ); - if ( hasFatalErrors(problems) ) + if ( hasFatalErrors( problems ) ) { throw problems.newModelBuildingException(); } @@ -562,10 +562,10 @@ public class DefaultModelBuilder } catch ( InvalidRepositoryException e ) { - problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE) - .setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage()) - .setLocation(repository.getLocation( "" )) - .setException(e) ); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() ) + .setLocation( repository.getLocation( "" ) ) + .setException( e ) ); } } } @@ -617,9 +617,9 @@ public class DefaultModelBuilder if ( versions.get( key ) == null && managedVersions.get( key ) == null ) { InputLocation location = plugins.get( key ).getLocation( "" ); - problems.add( new ModelProblemCollectorRequest(Severity.WARNING, Version.V20) - .setMessage( "'build.plugins.plugin.version' for " + key + " is missing.") - .setLocation(location)); + problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ) + .setMessage( "'build.plugins.plugin.version' for " + key + " is missing." ) + .setLocation( location ) ); } } } @@ -694,10 +694,10 @@ public class DefaultModelBuilder if ( !"pom".equals( parentModel.getPackaging() ) ) { - problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE) - .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel ) + ", must be \"pom\" but is \"" - + parentModel.getPackaging() + "\"") - .setLocation(parentModel.getLocation( "packaging" ))); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel ) + + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" ) + .setLocation( parentModel.getLocation( "packaging" ) ) ); } } else @@ -749,9 +749,9 @@ public class DefaultModelBuilder buffer.append( ", please verify your project structure" ); problems.setSource( childModel ); - problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE) - .setMessage( buffer.toString()) - .setLocation( parent.getLocation( "" ))); + problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE ) + .setMessage( buffer.toString() ) + .setLocation( parent.getLocation( "" ) ) ); return null; } if ( version == null || !version.equals( parent.getVersion() ) ) @@ -843,10 +843,10 @@ public class DefaultModelBuilder } } - problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE) - .setMessage( buffer.toString()) - .setLocation(parent.getLocation( "" )) - .setException(e)); + problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ) + .setMessage( buffer.toString() ) + .setLocation( parent.getLocation( "" ) ) + .setException( e ) ); throw problems.newModelBuildingException(); } @@ -912,23 +912,26 @@ public class DefaultModelBuilder if ( groupId == null || groupId.length() <= 0 ) { - problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE) - .setMessage( "'dependencyManagement.dependencies.dependency.groupId' for " + dependency.getManagementKey() + " is missing.") - .setLocation( dependency.getLocation( "" ))); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "'dependencyManagement.dependencies.dependency.groupId' for " + + dependency.getManagementKey() + " is missing." ) + .setLocation( dependency.getLocation( "" ) ) ); continue; } if ( artifactId == null || artifactId.length() <= 0 ) { - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) - .setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for " + dependency.getManagementKey() + " is missing.") - .setLocation( dependency.getLocation( "" ))); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for " + + dependency.getManagementKey() + " is missing." ) + .setLocation( dependency.getLocation( "" ) ) ); continue; } if ( version == null || version.length() <= 0 ) { - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) - .setMessage( "'dependencyManagement.dependencies.dependency.version' for " + dependency.getManagementKey() + " is missing.") - .setLocation( dependency.getLocation( "" ))); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "'dependencyManagement.dependencies.dependency.version' for " + + dependency.getManagementKey() + " is missing." ) + .setLocation( dependency.getLocation( "" ) ) ); continue; } @@ -942,7 +945,7 @@ public class DefaultModelBuilder message += modelId + " -> "; } message += imported; - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message )); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message ) ); continue; } @@ -976,8 +979,8 @@ public class DefaultModelBuilder problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( buffer.toString() ) - .setLocation( dependency.getLocation( "" )) - .setException( e )); + .setLocation( dependency.getLocation( "" ) ) + .setException( e ) ); continue; } @@ -1076,24 +1079,31 @@ public class DefaultModelBuilder && ( version == null || message.contains( version ) ); } - protected boolean hasModelErrors(ModelProblemCollectorExt problems) { - if (problems instanceof DefaultModelProblemCollector) { - return ((DefaultModelProblemCollector)problems).hasErrors(); - } else { - //the default execution path only knows the DefaultModelProblemCollector, - // only reason it's not in signature is because it's package private - throw new IllegalStateException(); + protected boolean hasModelErrors( ModelProblemCollectorExt problems ) + { + if ( problems instanceof DefaultModelProblemCollector ) + { + return ( (DefaultModelProblemCollector) problems ).hasErrors(); + } + else + { + // the default execution path only knows the DefaultModelProblemCollector, + // only reason it's not in signature is because it's package private + throw new IllegalStateException(); } - } - protected boolean hasFatalErrors(ModelProblemCollectorExt problems) { - if (problems instanceof DefaultModelProblemCollector) { - return ((DefaultModelProblemCollector)problems).hasFatalErrors(); - } else { - //the default execution path only knows the DefaultModelProblemCollector, + protected boolean hasFatalErrors( ModelProblemCollectorExt problems ) + { + if ( problems instanceof DefaultModelProblemCollector ) + { + return ( (DefaultModelProblemCollector) problems ).hasFatalErrors(); + } + else + { + // the default execution path only knows the DefaultModelProblemCollector, // only reason it's not in signature is because it's package private - throw new IllegalStateException(); + throw new IllegalStateException(); } } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java index e0effac17f..0d68aaeb5d 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java @@ -146,7 +146,8 @@ public class DefaultModelProblem return severity; } - public Version getVersion() { + public Version getVersion() + { return version; } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java index e2573eb69d..114afeb2de 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java @@ -23,10 +23,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Set; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Model; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblem.Version; import org.apache.maven.model.io.ModelParseException; /** @@ -174,7 +171,9 @@ class DefaultModelProblemCollector column = e.getColumnNumber(); } - ModelProblem problem = new DefaultModelProblem( req.getMessage(), req.getSeverity(), req.getVersion(), source, line, column, modelId, req.getException() ); + ModelProblem problem = + new DefaultModelProblem( req.getMessage(), req.getSeverity(), req.getVersion(), source, line, column, + modelId, req.getException() ); add( problem ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java index 811f2e0a16..555f033c92 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java @@ -41,7 +41,8 @@ public interface ModelProblem } - enum Version { + enum Version + { //based on ModeBuildingResult.validationLevel BASE, V20, diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java index b2321037fc..961d40abdf 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java @@ -19,9 +19,6 @@ package org.apache.maven.model.building; * under the License. */ -import java.util.List; -import org.apache.maven.model.InputLocation; - /** * Collects problems that are encountered during model building. The primary purpose of this component is to account for * the fact that the problem reporter has/should not have information about the calling context and hence cannot provide diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java index d91c5c2ed5..60bfdde207 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java @@ -1,20 +1,24 @@ -/* - * Copyright 2012 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.apache.maven.model.building; +/* + * 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.model.InputLocation; import org.apache.maven.model.building.ModelProblem.Severity; import org.apache.maven.model.building.ModelProblem.Version; @@ -38,17 +42,17 @@ public final class ModelProblemCollectorRequest * @param severity * @param version */ - public ModelProblemCollectorRequest(Severity severity, Version version) + public ModelProblemCollectorRequest( Severity severity, Version version ) { this.severity = severity; this.version = version; - if (severity == null) + if ( severity == null ) { - throw new IllegalStateException("No severity declared"); + throw new IllegalStateException( "No severity declared" ); } - if (version == null) + if ( version == null ) { - throw new IllegalStateException("No version declared."); + throw new IllegalStateException( "No version declared." ); } } @@ -67,7 +71,7 @@ public final class ModelProblemCollectorRequest return exception; } - public ModelProblemCollectorRequest setException(Exception exception) + public ModelProblemCollectorRequest setException( Exception exception ) { this.exception = exception; return this; @@ -78,7 +82,7 @@ public final class ModelProblemCollectorRequest return message; } - public ModelProblemCollectorRequest setMessage(String message) + public ModelProblemCollectorRequest setMessage( String message ) { this.message = message; return this; @@ -89,7 +93,7 @@ public final class ModelProblemCollectorRequest return location; } - public ModelProblemCollectorRequest setLocation(InputLocation location) + public ModelProblemCollectorRequest setLocation( InputLocation location ) { this.location = location; return this; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java index dc8b41b6ad..57e11c3c21 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java @@ -45,7 +45,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Properties; -import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblem.Version; import org.apache.maven.model.building.ModelProblemCollectorRequest; @@ -244,7 +243,8 @@ public abstract class AbstractStringBasedModelInterpolator } catch ( InterpolationException e ) { - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( e.getMessage() ).setException( e )); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( e.getMessage() ).setException( e ) ); } interpolator.clearFeedback(); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java index 106414eaf5..8167baf7ec 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java @@ -20,7 +20,6 @@ package org.apache.maven.model.interpolation; */ import java.util.List; -import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.building.ModelProblem.Severity; @@ -65,7 +64,7 @@ class ProblemDetectingValueSource { msg += " Please use ${" + newPrefix + expression.substring( bannedPrefix.length() ) + "} instead."; } - problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg )); + problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg ) ); } return value; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java index d4bc534618..2ef7eb1333 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java @@ -49,7 +49,7 @@ public class StringSearchModelInterpolator extends AbstractStringBasedModelInterpolator { - private static final Map, InterpolateObjectAction.CacheItem> cachedEntries = + private static final Map, InterpolateObjectAction.CacheItem> CACHED_ENTRIES = new ConcurrentHashMap, InterpolateObjectAction.CacheItem>( 80, 0.75f, 2 ); // Empirical data from 3.x, actual =40 @@ -161,11 +161,11 @@ public class StringSearchModelInterpolator private CacheItem getCacheEntry( Class cls ) { - CacheItem cacheItem = cachedEntries.get( cls ); + CacheItem cacheItem = CACHED_ENTRIES.get( cls ); if ( cacheItem == null ) { cacheItem = new CacheItem( cls ); - cachedEntries.put( cls, cacheItem ); + CACHED_ENTRIES.put( cls, cacheItem ); } return cacheItem; } @@ -247,7 +247,7 @@ public class StringSearchModelInterpolator } else if ( Collection.class.isAssignableFrom( type ) ) { - throw new RuntimeException("We dont interpolate into collections, use a list instead"); + throw new RuntimeException( "We dont interpolate into collections, use a list instead" ); } else if ( Map.class.isAssignableFrom( type ) ) { @@ -278,7 +278,7 @@ public class StringSearchModelInterpolator } } - static abstract class CacheField + abstract static class CacheField { protected final Field field; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java index 6a95b97cf3..f8a2a93ba9 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java @@ -108,9 +108,9 @@ public class DefaultReportingConverter && request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 ) { - problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V31) - .setMessage( "The section is deprecated, please move the reports to the section of the new Maven Site Plugin.") - .setLocation( reporting.getLocation( "" ) )); + problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V31 ) + .setMessage( "The section is deprecated, please move the reports to the section of the new Maven Site Plugin." ) + .setLocation( reporting.getLocation( "" ) ) ); } for ( ReportPlugin plugin : reporting.getPlugins() ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java index dc004105fb..c376c999e3 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java @@ -115,10 +115,10 @@ public class DefaultProfileSelector } catch ( RuntimeException e ) { - problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE) - .setMessage( "Failed to determine activation for profile " + profile.getId()) - .setLocation( profile.getLocation( "" )) - .setException( e )); + problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) + .setMessage( "Failed to determine activation for profile " + profile.getId() ) + .setLocation( profile.getLocation( "" ) ) + .setException( e ) ); return false; } } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java index 7fa55378a2..62b6cfb7b5 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java @@ -65,7 +65,7 @@ public class JdkVersionProfileActivator { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Failed to determine Java version for profile " + profile.getId() ) - .setLocation(activation.getLocation( "jdk" ) ) ); + .setLocation( activation.getLocation( "jdk" ) ) ); return false; } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index ff084f7201..77219a7b04 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -62,7 +62,7 @@ public class DefaultModelValidator implements ModelValidator { - private static final Pattern ID_REGEX = Pattern.compile("[A-Za-z0-9_\\-.]+"); + private static final Pattern ID_REGEX = Pattern.compile( "[A-Za-z0-9_\\-.]+" ); private static final String ILLEGAL_FS_CHARS = "\\/:\"<>|?*"; @@ -230,8 +230,9 @@ public class DefaultModelValidator { if ( !"pom".equals( model.getPackaging() ) ) { - addViolation( problems, Severity.ERROR, Version.BASE,"packaging", null, "with value '" + model.getPackaging() - + "' is invalid. Aggregator projects " + "require 'pom' as packaging.", model ); + addViolation( problems, Severity.ERROR, Version.BASE, "packaging", null, + "with value '" + model.getPackaging() + "' is invalid. Aggregator projects " + + "require 'pom' as packaging.", model ); } for ( int i = 0, n = model.getModules().size(); i < n; i++ ) @@ -850,7 +851,8 @@ public class DefaultModelValidator buffer.append( ' ' ).append( message ); - problems.add( new ModelProblemCollectorRequest( severity, version ).setMessage( buffer.toString() ).setLocation( getLocation( fieldName, tracker ))); + problems.add( new ModelProblemCollectorRequest( severity, version ) + .setMessage( buffer.toString() ).setLocation( getLocation( fieldName, tracker ) ) ); } private static InputLocation getLocation( String fieldName, InputLocationTracker tracker ) From 971f1cf749fad05c41a2589f51629d1c68902e6a Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Mon, 3 Dec 2012 13:43:11 +0100 Subject: [PATCH 027/102] add a timeout to prevent hanging too long --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 2322be3c84..72a6a881e2 100644 --- a/build.xml +++ b/build.xml @@ -247,7 +247,7 @@ Do you want to continue? - + From b3a91ebe35e5c6adbbe1a7d1f960e4c8b72347af Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Mon, 3 Dec 2012 13:45:24 +0100 Subject: [PATCH 028/102] add more memory too --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 72a6a881e2..3a6d0302f5 100644 --- a/build.xml +++ b/build.xml @@ -247,7 +247,7 @@ Do you want to continue? - + From d32fb267b241f2f836d7702c111d0af44d73676c Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Mon, 3 Dec 2012 13:47:28 +0100 Subject: [PATCH 029/102] oups I missed something here. --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 3a6d0302f5..4bbbec927f 100644 --- a/build.xml +++ b/build.xml @@ -247,7 +247,7 @@ Do you want to continue? - + From 5ccb925067825fe64519cd6d0464838ef5f11885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 3 Dec 2012 19:10:23 +0100 Subject: [PATCH 030/102] added Plexus LoggerManager injection --- maven-embedder/src/site/apt/logging.apt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maven-embedder/src/site/apt/logging.apt b/maven-embedder/src/site/apt/logging.apt index cb860d0748..fc3834efc4 100644 --- a/maven-embedder/src/site/apt/logging.apt +++ b/maven-embedder/src/site/apt/logging.apt @@ -22,7 +22,7 @@ Maven Logging * Getting Logger Instance - Plexus Logger can be injected in Plexus component using Plexus annotations + Plexus Logger and LoggerManager can be injected in Plexus component using Plexus annotations +------+ import org.codehaus.plexus.logging.Logger; @@ -35,6 +35,9 @@ public class DefaultMyComponent { @Requirement private Logger logger; + + @Requirement + private LoggerManager loggerManager; } +------+ From ac213ec571d838bec24adc85991f5e30dab87a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 3 Dec 2012 23:27:47 +0100 Subject: [PATCH 031/102] [MNG-5245] updated maven-site-plugin to 3.2 --- maven-core/src/main/resources/META-INF/plexus/components.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-core/src/main/resources/META-INF/plexus/components.xml b/maven-core/src/main/resources/META-INF/plexus/components.xml index 07515533e5..6282ba0971 100644 --- a/maven-core/src/main/resources/META-INF/plexus/components.xml +++ b/maven-core/src/main/resources/META-INF/plexus/components.xml @@ -129,10 +129,10 @@ under the License. - org.apache.maven.plugins:maven-site-plugin:3.1:site + org.apache.maven.plugins:maven-site-plugin:3.2:site - org.apache.maven.plugins:maven-site-plugin:3.1:deploy + org.apache.maven.plugins:maven-site-plugin:3.2:deploy From 618d12906d044054815dc0b100065061767ab60b Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Mon, 3 Dec 2012 19:58:40 -0800 Subject: [PATCH 032/102] [maven-release-plugin] prepare release maven-3.1.0 --- apache-maven/pom.xml | 2 +- maven-aether-provider/pom.xml | 2 +- maven-artifact/pom.xml | 2 +- maven-compat/pom.xml | 2 +- maven-core/pom.xml | 2 +- maven-embedder/pom.xml | 2 +- maven-model-builder/pom.xml | 2 +- maven-model/pom.xml | 2 +- maven-plugin-api/pom.xml | 2 +- maven-repository-metadata/pom.xml | 2 +- maven-settings-builder/pom.xml | 2 +- maven-settings/pom.xml | 2 +- pom.xml | 3 ++- 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index ce547e777e..aeb177ffa8 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -21,7 +21,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 apache-maven diff --git a/maven-aether-provider/pom.xml b/maven-aether-provider/pom.xml index 6c611771d8..720ebd4a2e 100644 --- a/maven-aether-provider/pom.xml +++ b/maven-aether-provider/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-aether-provider diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml index 2b1256e426..2ac838edab 100644 --- a/maven-artifact/pom.xml +++ b/maven-artifact/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-artifact diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml index 3bdb1aa53c..f58bbf05fb 100644 --- a/maven-compat/pom.xml +++ b/maven-compat/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-compat diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 41e2079298..ad494a3cc7 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-core diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 587398f371..8708ce5f4e 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-embedder diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml index a5b1aa196f..868bed97d9 100644 --- a/maven-model-builder/pom.xml +++ b/maven-model-builder/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-model-builder diff --git a/maven-model/pom.xml b/maven-model/pom.xml index f00f6b034c..fc42596f75 100644 --- a/maven-model/pom.xml +++ b/maven-model/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-model diff --git a/maven-plugin-api/pom.xml b/maven-plugin-api/pom.xml index 227f574526..9bfe8a38bc 100644 --- a/maven-plugin-api/pom.xml +++ b/maven-plugin-api/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-plugin-api diff --git a/maven-repository-metadata/pom.xml b/maven-repository-metadata/pom.xml index 18da94ccb6..70e2f2fd31 100644 --- a/maven-repository-metadata/pom.xml +++ b/maven-repository-metadata/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-repository-metadata diff --git a/maven-settings-builder/pom.xml b/maven-settings-builder/pom.xml index 4538b2da9c..a1cd161815 100644 --- a/maven-settings-builder/pom.xml +++ b/maven-settings-builder/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-settings-builder diff --git a/maven-settings/pom.xml b/maven-settings/pom.xml index 01fbd886f8..b4abe63319 100644 --- a/maven-settings/pom.xml +++ b/maven-settings/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1-SNAPSHOT + 3.1.0 maven-settings diff --git a/pom.xml b/pom.xml index c97b7f317b..50b289ceb8 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ maven - 3.1-SNAPSHOT + 3.1.0 pom Apache Maven @@ -87,6 +87,7 @@ scm:git:https://git-wip-us.apache.org/repos/asf/maven.git scm:git:https://git-wip-us.apache.org/repos/asf/maven.git https://git-wip-us.apache.org/repos/asf?p=maven.git + maven-3.1.0 jira From 73e144598736aa8ccb5836b70a2d0fd8b26c9fcf Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Mon, 3 Dec 2012 19:58:46 -0800 Subject: [PATCH 033/102] [maven-release-plugin] prepare for next development iteration --- apache-maven/pom.xml | 2 +- maven-aether-provider/pom.xml | 2 +- maven-artifact/pom.xml | 2 +- maven-compat/pom.xml | 2 +- maven-core/pom.xml | 2 +- maven-embedder/pom.xml | 2 +- maven-model-builder/pom.xml | 2 +- maven-model/pom.xml | 2 +- maven-plugin-api/pom.xml | 2 +- maven-repository-metadata/pom.xml | 2 +- maven-settings-builder/pom.xml | 2 +- maven-settings/pom.xml | 2 +- pom.xml | 4 ++-- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index aeb177ffa8..ce547e777e 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -21,7 +21,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT apache-maven diff --git a/maven-aether-provider/pom.xml b/maven-aether-provider/pom.xml index 720ebd4a2e..6c611771d8 100644 --- a/maven-aether-provider/pom.xml +++ b/maven-aether-provider/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-aether-provider diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml index 2ac838edab..2b1256e426 100644 --- a/maven-artifact/pom.xml +++ b/maven-artifact/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-artifact diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml index f58bbf05fb..3bdb1aa53c 100644 --- a/maven-compat/pom.xml +++ b/maven-compat/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-compat diff --git a/maven-core/pom.xml b/maven-core/pom.xml index ad494a3cc7..41e2079298 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-core diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 8708ce5f4e..587398f371 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-embedder diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml index 868bed97d9..a5b1aa196f 100644 --- a/maven-model-builder/pom.xml +++ b/maven-model-builder/pom.xml @@ -16,7 +16,7 @@ org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-model-builder diff --git a/maven-model/pom.xml b/maven-model/pom.xml index fc42596f75..f00f6b034c 100644 --- a/maven-model/pom.xml +++ b/maven-model/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-model diff --git a/maven-plugin-api/pom.xml b/maven-plugin-api/pom.xml index 9bfe8a38bc..227f574526 100644 --- a/maven-plugin-api/pom.xml +++ b/maven-plugin-api/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-plugin-api diff --git a/maven-repository-metadata/pom.xml b/maven-repository-metadata/pom.xml index 70e2f2fd31..18da94ccb6 100644 --- a/maven-repository-metadata/pom.xml +++ b/maven-repository-metadata/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-repository-metadata diff --git a/maven-settings-builder/pom.xml b/maven-settings-builder/pom.xml index a1cd161815..4538b2da9c 100644 --- a/maven-settings-builder/pom.xml +++ b/maven-settings-builder/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-settings-builder diff --git a/maven-settings/pom.xml b/maven-settings/pom.xml index b4abe63319..01fbd886f8 100644 --- a/maven-settings/pom.xml +++ b/maven-settings/pom.xml @@ -25,7 +25,7 @@ under the License. org.apache.maven maven - 3.1.0 + 3.1-SNAPSHOT maven-settings diff --git a/pom.xml b/pom.xml index 50b289ceb8..626195d825 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ maven - 3.1.0 + 3.1-SNAPSHOT pom Apache Maven @@ -87,7 +87,7 @@ scm:git:https://git-wip-us.apache.org/repos/asf/maven.git scm:git:https://git-wip-us.apache.org/repos/asf/maven.git https://git-wip-us.apache.org/repos/asf?p=maven.git - maven-3.1.0 + HEAD jira From 19492b485a1a9ec26aadc22b51aa058ce1c405bd Mon Sep 17 00:00:00 2001 From: Anders Hammar Date: Tue, 4 Dec 2012 13:50:03 +0100 Subject: [PATCH 034/102] [MNG-5403] tar.gz release artifacts have wrong permissions on directories Upgrading to m-assembly-p v2.4 solves this. Signed-off-by: Anders Hammar --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 626195d825..e32d6dc694 100644 --- a/pom.xml +++ b/pom.xml @@ -393,7 +393,7 @@ org.apache.maven.plugins maven-assembly-plugin - 2.2-beta-5 + 2.4 org.codehaus.mojo From f95ab2e7cdb488442ab923abe6ec856efc993dd3 Mon Sep 17 00:00:00 2001 From: Anders Hammar Date: Wed, 5 Dec 2012 14:21:04 +0100 Subject: [PATCH 035/102] [MNG-5402] Better build number for git Signed-off-by: Anders Hammar --- maven-core/pom.xml | 94 ++++++------------- .../apache/maven/cli/CLIReportingUtils.java | 2 +- pom.xml | 2 +- 3 files changed, 29 insertions(+), 69 deletions(-) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 41e2079298..3e18639f15 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -124,73 +124,33 @@ + + org.codehaus.mojo + buildnumber-maven-plugin + + + create-noncanonicalrev + + create-timestamp + + + 'NON-CANONICAL_'yyyy-MM-dd_HH-mm_'${user.name}' + nonCanonicalRevision + + + + create-buildnumber + + create + + + false + false + ${nonCanonicalRevision} + + + + - - - - svn-buildnumber - - - .svn - - - - - - org.codehaus.mojo - buildnumber-maven-plugin - - - generate-resources - - create - - - - - false - false - - javasvn - - - - - - - - non-canonical-buildnumber - - - .svn - - - - - - org.codehaus.mojo - buildnumber-maven-plugin - - - generate-resources - - create - - - - - false - false - NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1} - - timestamp - ${user.name} - - - - - - - diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java index 8f1ae8e163..6173959a1f 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java @@ -83,7 +83,7 @@ public final class CLIReportingUtils if ( rev != null || timestamp != null ) { msg += " ("; - msg += ( rev != null ? "r" + rev : "" ); + msg += ( rev != null ? rev : "" ); if ( timestamp != null ) { SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ssZ" ); diff --git a/pom.xml b/pom.xml index e32d6dc694..d6739391d2 100644 --- a/pom.xml +++ b/pom.xml @@ -398,7 +398,7 @@ org.codehaus.mojo buildnumber-maven-plugin - 1.0 + 1.2 org.apache.maven.plugins From 23bd8d98a66ea7bc078a96447ee7ed8555ceaaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 8 Dec 2012 16:05:37 +0100 Subject: [PATCH 036/102] added @since info --- .../classrealm/DefaultClassRealmManager.java | 7 +++++-- .../maven/plugin/descriptor/MojoDescriptor.java | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java index 0db5b4b29f..e6e15d2c31 100644 --- a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java +++ b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java @@ -127,7 +127,7 @@ public class DefaultClassRealmManager return mavenRealm; } - private void importMavenApi( Map imports ) + private void importMavenApi( Map imports, boolean importSlf4japi ) { ClassRealm coreRealm = getCoreRealm(); @@ -219,7 +219,10 @@ public class DefaultClassRealmManager // imports.put( "com.google.inject.util.*", coreRealm ); // SLF4J - imports.put( "org.slf4j.*", coreRealm ); + if ( importSlf4japi ) + { + imports.put( "org.slf4j.*", coreRealm ); + } } /** diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java index d73f66d5f4..8c3d9da894 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java @@ -108,7 +108,10 @@ public class MojoDescriptor /** Specify the required dependencies in a specified scope */ private String dependencyResolutionRequired = null; - /** The scope of (transitive) dependencies that should be collected but not resolved. */ + /** + * The scope of (transitive) dependencies that should be collected but not resolved. + * @since 3.0-alpha-3 + */ private String dependencyCollectionRequired; /** By default, the Mojo needs a Maven project to be executed */ @@ -132,7 +135,10 @@ public class MojoDescriptor /** By default, the Mojo don't need reports to run */ private boolean requiresReports = false; - /** By default, mojos are not threadsafe */ + /** + * By default, mojos are not threadsafe + * @since 3.0-beta-2 + */ private boolean threadSafe = false; /** @@ -271,6 +277,9 @@ public class MojoDescriptor return dependencyResolutionRequired; } + /** + * @since 3.0-alpha-3 + */ public void setDependencyCollectionRequired( String requiresDependencyCollection ) { this.dependencyCollectionRequired = requiresDependencyCollection; @@ -284,6 +293,7 @@ public class MojoDescriptor * full dependency resolution might fail due to projects which haven't been built yet. * * @return The scope of (transitive) dependencies that should be collected or {@code null} if none. + * @since 3.0-alpha-3 */ public String getDependencyCollectionRequired() { @@ -664,6 +674,7 @@ public class MojoDescriptor /** * @return True if the Mojo is thread-safe and can be run safely in parallel + * @since 3.0-beta-2 */ public boolean isThreadSafe() { @@ -672,6 +683,7 @@ public class MojoDescriptor /** * @param threadSafe indicates that the mojo is thread-safe and can be run safely in parallel + * @since 3.0-beta-2 */ public void setThreadSafe( boolean threadSafe ) { From d6544c4814a91c15d67a05d60e18f91a72fc57a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 8 Dec 2012 17:47:12 +0100 Subject: [PATCH 037/102] reverted change that got in previous commit by inadvertance --- .../apache/maven/classrealm/DefaultClassRealmManager.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java index e6e15d2c31..0db5b4b29f 100644 --- a/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java +++ b/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java @@ -127,7 +127,7 @@ public class DefaultClassRealmManager return mavenRealm; } - private void importMavenApi( Map imports, boolean importSlf4japi ) + private void importMavenApi( Map imports ) { ClassRealm coreRealm = getCoreRealm(); @@ -219,10 +219,7 @@ public class DefaultClassRealmManager // imports.put( "com.google.inject.util.*", coreRealm ); // SLF4J - if ( importSlf4japi ) - { - imports.put( "org.slf4j.*", coreRealm ); - } + imports.put( "org.slf4j.*", coreRealm ); } /** From c8536bf89f30b68cc00e4c23c28f6a2370d8ec4c Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sat, 8 Dec 2012 19:30:57 -0500 Subject: [PATCH 038/102] - make m2e happy on import --- maven-core/pom.xml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 3e18639f15..dcc269947b 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -152,5 +152,34 @@ + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + [1.2,) + + create-timestamp + + + + + + + + + + + + From 3d4a06c7009f159a40fd94d911b5d41e07330701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 12 Dec 2012 01:57:02 +0100 Subject: [PATCH 039/102] added ClassRealmManager entry point --- maven-core/src/site/apt/index.apt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/maven-core/src/site/apt/index.apt b/maven-core/src/site/apt/index.apt index 72d4696a7d..4043c80ccd 100644 --- a/maven-core/src/site/apt/index.apt +++ b/maven-core/src/site/apt/index.apt @@ -26,4 +26,9 @@ Maven Core ({{{./xref/org/apache/maven/plugin/internal/DefaultMavenPluginManager.html}source}}), * {{{./apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html}PluginParameterExpressionEvaluator}}, used to - evaluate plugin parameters values during Mojo configuration. + evaluate plugin parameters values during Mojo configuration, + + * {{{/guides/mini/guide-maven-classloading.html}classloader hierarchy}} done by <<>> component + ({{{./apidocs/org/apache/maven/classrealm/ClassRealmManager.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/classrealm/DefaultClassRealmManager.html}source}}). From 87952bd073388d95da37b1b0e13640c6966729aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 12 Dec 2012 17:37:03 +0100 Subject: [PATCH 040/102] added link to Plexus Classworlds --- maven-core/src/site/apt/index.apt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maven-core/src/site/apt/index.apt b/maven-core/src/site/apt/index.apt index 4043c80ccd..f1c63294ce 100644 --- a/maven-core/src/site/apt/index.apt +++ b/maven-core/src/site/apt/index.apt @@ -31,4 +31,5 @@ Maven Core * {{{/guides/mini/guide-maven-classloading.html}classloader hierarchy}} done by <<>> component ({{{./apidocs/org/apache/maven/classrealm/ClassRealmManager.html}javadoc}}), with its <<>> implementation - ({{{./xref/org/apache/maven/classrealm/DefaultClassRealmManager.html}source}}). + ({{{./xref/org/apache/maven/classrealm/DefaultClassRealmManager.html}source}}), using + {{{http://plexus.codehaus.org/plexus-classworlds/}Plexus Classworlds}}. From a40df3ab833b237c8c6a9234c3c5093503f46781 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 14 Dec 2012 14:51:09 +0100 Subject: [PATCH 041/102] configure memory for forked java --- build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 4bbbec927f..14628b2b24 100644 --- a/build.xml +++ b/build.xml @@ -247,8 +247,9 @@ Do you want to continue? - + + From d8cc98c8be85f87e205e08c9783ce4269ab479d2 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 14 Dec 2012 15:00:10 +0100 Subject: [PATCH 042/102] make fork or not configurable for ci testing --- build.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 14628b2b24..2dcf0944c8 100644 --- a/build.xml +++ b/build.xml @@ -36,6 +36,8 @@ END SNIPPET: ant-bootstrap --> + + Building ${distributionName} ... @@ -247,9 +249,9 @@ Do you want to continue? - + - + From 68a54c7e227702fce27a597b3e589afca9090c13 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 14 Dec 2012 15:29:00 +0100 Subject: [PATCH 043/102] revert ${maven-compile.jvmargs} usage as look to fail on ci but not locally , sorry olamy != ant guru :-) --- build.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 2dcf0944c8..6b93808323 100644 --- a/build.xml +++ b/build.xml @@ -38,6 +38,7 @@ END SNIPPET: ant-bootstrap --> + Building ${distributionName} ... @@ -249,9 +250,9 @@ Do you want to continue? - + - + From 866f2c58b85a6a34297b913a69569535f5f84684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 15 Dec 2012 10:48:38 +0100 Subject: [PATCH 044/102] prepared svnpubsub for site --- pom.xml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index d6739391d2..7ed3df43f4 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ number of other development tools for reporting or the build process. - ${siteUrl} + http://maven.apache.org/ref/${project.version} 2001 @@ -62,10 +62,7 @@ apache-maven Maven Apache Maven - - scp://people.apache.org/www/maven.apache.org/ref/${project.version}/ - http://maven.apache.org/ref/${project.version}/ - + ${user.home}/maven-sites @@ -100,7 +97,7 @@ apache.website - ${siteDeployUrl} + scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/${project.version} @@ -412,6 +409,15 @@ + + org.apache.maven.plugins + maven-scm-publish-plugin + 1.0-beta-2 + + ${maven.site.cache}/ref/${project.version} + true + + From 38e3de00cbbf9ed969d61e5a2fbefd8d24642711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 15 Dec 2012 10:56:15 +0100 Subject: [PATCH 045/102] javadoc formatting --- .../DefaultInheritanceAssembler.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java index a66be04dea..92f44052f4 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java @@ -58,12 +58,17 @@ public class DefaultInheritanceAssembler /** * Calculates the relative path from the base directory of the parent to the parent directory of the base directory - * of the child. The general idea is to adjust inherited URLs to match the project layout (in SCM). This calculation - * is only a heuristic based on our conventions. In detail, the algo relies on the following assumptions. The parent - * uses aggregation and refers to the child via the modules section. The module path to the child is considered to - * point at the POM rather than its base directory if the path ends with ".xml" (ignoring case). The name of the - * child's base directory matches the artifact id of the child. Note that for the sake of independence from the user - * environment, the filesystem is intentionally not used for the calculation. + * of the child. The general idea is to adjust inherited URLs to match the project layout (in SCM). + * + *

This calculation is only a heuristic based on our conventions. + * In detail, the algo relies on the following assumptions:

    + *
  • The parent uses aggregation and refers to the child via the modules section
  • + *
  • The module path to the child is considered to + * point at the POM rather than its base directory if the path ends with ".xml" (ignoring case)
  • + *
  • The name of the child's base directory matches the artifact id of the child.
  • + *
+ * Note that for the sake of independence from the user + * environment, the filesystem is intentionally not used for the calculation.

* * @param child The child model, must not be null. * @param parent The parent model, may be null. From 950b9b3c58f74ebce30dc224f8a101972eac8d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 15 Dec 2012 11:14:31 +0100 Subject: [PATCH 046/102] added more pointers to sources --- maven-model-builder/src/site/apt/index.apt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt index ed3930c4d4..0b604c9edb 100644 --- a/maven-model-builder/src/site/apt/index.apt +++ b/maven-model-builder/src/site/apt/index.apt @@ -24,23 +24,31 @@ Maven Model Builder ** profile activation (see {{{./apidocs/org/apache/maven/model/profile/activation/package-summary.html}available activators}}) - ** model normalization + ** model normalization: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/normalization/DefaultModelNormalizer.html}source}}) ** profile injection ** parent resolution until {{{./super-pom.html}super-pom}} - ** inheritance assembly + ** inheritance assembly: <<>> ({{{./apidocs/org/apache/maven/model/inheritance/InheritanceAssembler.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.html}source}}) ** model interpolation (see below) - ** url normalization + ** url normalization: <<>> ({{{./apidocs/org/apache/maven/model/path/UrlNormalizer.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/path/DefaultUrlNormalizer.html}source}}) [] * phase 2 - ** model path translation + ** model path translation: <<>> ({{{./apidocs/org/apache/maven/model/path/ModelPathTranslator.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/path/DefaultModelPathTranslator.html}source}}) ** plugin management injection @@ -56,7 +64,9 @@ Maven Model Builder ** <(optional)> plugins configuration - ** effective model validation + ** effective model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}}) [] From a07fdf076cc4b590cfa2a0e608fcbd75ce63ec3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 15 Dec 2012 21:06:57 +0100 Subject: [PATCH 047/102] improved javadoc --- .../maven/model/merge/MavenModelMerger.java | 31 ++++---- .../apache/maven/model/merge/ModelMerger.java | 71 +++++++++++-------- 2 files changed, 56 insertions(+), 46 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java index 92c0ee6a94..568bbcb2a0 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java @@ -52,7 +52,8 @@ import org.apache.maven.model.Scm; import org.apache.maven.model.Site; /** - * The domain-specific model merger for the Maven POM. + * The domain-specific model merger for the Maven POM, overriding generic code from parent class when necessary with + * more adapted algorithms. * * @author Benjamin Bentmann */ @@ -631,45 +632,45 @@ public class MavenModelMerger } @Override - protected Object getPluginKey( Plugin object ) + protected Object getPluginKey( Plugin plugin ) { - return object.getKey(); + return plugin.getKey(); } @Override - protected Object getPluginExecutionKey( PluginExecution object ) + protected Object getPluginExecutionKey( PluginExecution pluginExecution ) { - return object.getId(); + return pluginExecution.getId(); } @Override - protected Object getReportPluginKey( ReportPlugin object ) + protected Object getReportPluginKey( ReportPlugin reportPlugin ) { - return object.getKey(); + return reportPlugin.getKey(); } @Override - protected Object getReportSetKey( ReportSet object ) + protected Object getReportSetKey( ReportSet reportSet ) { - return object.getId(); + return reportSet.getId(); } @Override - protected Object getRepositoryBaseKey( RepositoryBase object ) + protected Object getRepositoryBaseKey( RepositoryBase repositoryBase ) { - return object.getId(); + return repositoryBase.getId(); } @Override - protected Object getExtensionKey( Extension object ) + protected Object getExtensionKey( Extension extension ) { - return object.getGroupId() + ':' + object.getArtifactId(); + return extension.getGroupId() + ':' + extension.getArtifactId(); } @Override - protected Object getExclusionKey( Exclusion object ) + protected Object getExclusionKey( Exclusion exclusion ) { - return object.getGroupId() + ':' + object.getArtifactId(); + return exclusion.getGroupId() + ':' + exclusion.getArtifactId(); } private String appendPath( String parentPath, Map context ) diff --git a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java index 3c9e749e90..88e866b0b2 100644 --- a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java +++ b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java @@ -71,7 +71,16 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; /** * This is a hand-crafted prototype of the default model merger that should eventually be generated by Modello by a new - * Java plugin. + * Java plugin. Code structure to merge source (read-only) object into the target object is:
    + *
  • mergeClassname( Classname target, Classname source, boolean sourceDominant, + * Map context ) for each model class
  • + *
  • mergeClassname_FieldName( Classname target, Classname source, boolean + * sourceDominant, Map context ) for each field of each model class
  • + *
  • Object getClassnameKey( Classname classname ) for each class that is used in a list
  • + *
+ * Code is written like it could be generated, with default behaviour to be overridden when necessary. + * This is particularly the case for Object getClassnameKey( Classname classname ) method, + * which by default return the object itself and is expected to be overridden to calculate better suited key value. * * @author Benjamin Bentmann */ @@ -2834,79 +2843,79 @@ public class ModelMerger return dependency; } - protected Object getPluginKey( Plugin object ) + protected Object getPluginKey( Plugin plugin ) { - return object; + return plugin; } - protected Object getPluginExecutionKey( PluginExecution object ) + protected Object getPluginExecutionKey( PluginExecution pluginExecution ) { - return object; + return pluginExecution; } - protected Object getReportPluginKey( ReportPlugin object ) + protected Object getReportPluginKey( ReportPlugin reportPlugin ) { - return object; + return reportPlugin; } - protected Object getReportSetKey( ReportSet object ) + protected Object getReportSetKey( ReportSet reportSet ) { - return object; + return reportSet; } - protected Object getLicenseKey( License object ) + protected Object getLicenseKey( License license ) { - return object; + return license; } - protected Object getMailingListKey( MailingList object ) + protected Object getMailingListKey( MailingList mailingList ) { - return object; + return mailingList; } - protected Object getDeveloperKey( Developer object ) + protected Object getDeveloperKey( Developer developer ) { - return object; + return developer; } - protected Object getContributorKey( Contributor object ) + protected Object getContributorKey( Contributor contributor ) { - return object; + return contributor; } - protected Object getProfileKey( Profile object ) + protected Object getProfileKey( Profile profile ) { - return object; + return profile; } - protected Object getRepositoryKey( Repository object ) + protected Object getRepositoryKey( Repository repository ) { - return getRepositoryBaseKey( object ); + return getRepositoryBaseKey( repository ); } - protected Object getRepositoryBaseKey( RepositoryBase object ) + protected Object getRepositoryBaseKey( RepositoryBase repositoryBase ) { - return object; + return repositoryBase; } - protected Object getNotifierKey( Notifier object ) + protected Object getNotifierKey( Notifier notifier ) { - return object; + return notifier; } - protected Object getResourceKey( Resource object ) + protected Object getResourceKey( Resource resource ) { - return object; + return resource; } - protected Object getExtensionKey( Extension object ) + protected Object getExtensionKey( Extension extension ) { - return object; + return extension; } - protected Object getExclusionKey( Exclusion object ) + protected Object getExclusionKey( Exclusion exclusion ) { - return object; + return exclusion; } } From 915b1553f205bbad876e736871767be2c6a5ab99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 15 Dec 2012 21:12:22 +0100 Subject: [PATCH 048/102] changed MavenModelMerger extensions visibility to protected to improve documentation --- .../maven/model/plugin/DefaultLifecycleBindingsInjector.java | 2 +- .../maven/model/inheritance/DefaultInheritanceAssembler.java | 2 +- .../model/management/DefaultDependencyManagementInjector.java | 2 +- .../maven/model/management/DefaultPluginManagementInjector.java | 2 +- .../maven/model/normalization/DefaultModelNormalizer.java | 2 +- .../org/apache/maven/model/profile/DefaultProfileInjector.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java b/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java index 5cb33637e5..46aeb0b6af 100644 --- a/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java +++ b/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java @@ -80,7 +80,7 @@ public class DefaultLifecycleBindingsInjector } } - private static class LifecycleBindingsMerger + protected static class LifecycleBindingsMerger extends MavenModelMerger { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java index 92f44052f4..01ff9d71a6 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java @@ -124,7 +124,7 @@ public class DefaultInheritanceAssembler return adjustment; } - private static class InheritanceModelMerger + protected static class InheritanceModelMerger extends MavenModelMerger { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java index fbfd4b8132..a13dcca6c5 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java @@ -50,7 +50,7 @@ public class DefaultDependencyManagementInjector merger.mergeManagedDependencies( model ); } - private static class ManagementModelMerger + protected static class ManagementModelMerger extends MavenModelMerger { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java index 1d5809d9a7..ba9f060aeb 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java @@ -53,7 +53,7 @@ public class DefaultPluginManagementInjector merger.mergeManagedBuildPlugins( model ); } - private static class ManagementModelMerger + protected static class ManagementModelMerger extends MavenModelMerger { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java index df7ae5b2ca..9163286a85 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java @@ -93,7 +93,7 @@ public class DefaultModelNormalizer } } - private static class DuplicateMerger + protected static class DuplicateMerger extends MavenModelMerger { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java index b7c8b1985f..38421bc4e9 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java @@ -71,7 +71,7 @@ public class DefaultProfileInjector } } - private static class ProfileModelMerger + protected static class ProfileModelMerger extends MavenModelMerger { From 73ffdaf86304457ed180a553b5daf1d73ba197f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 01:52:20 +0100 Subject: [PATCH 049/102] added license header --- .../maven/cli/logging/Slf4jStdoutLogger.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java index f1a27ae511..2b1d782c31 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jStdoutLogger.java @@ -1,5 +1,24 @@ package org.apache.maven.cli.logging; +/* + * 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.PrintStream; import org.slf4j.Logger; From 39e11cf2e51a41fc47001f0fe59da251dab87587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 01:57:36 +0100 Subject: [PATCH 050/102] extracted Slf4jConfiguration interface and corresponding implementation to clearly separate code depending on slf4j binding still need to add automatic selection of implementation --- .../java/org/apache/maven/cli/MavenCli.java | 12 ++-- .../logging/AbstractSlf4jConfiguration.java | 46 ++++++++++++++ .../maven/cli/logging/Slf4jConfiguration.java | 35 +++++++++++ .../impl/Slf4jSimpleConfiguration.java | 62 +++++++++++++++++++ 4 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index e744e65ed3..e3c62f89d1 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -39,8 +39,10 @@ import org.apache.maven.InternalErrorException; import org.apache.maven.Maven; import org.apache.maven.cli.event.DefaultEventSpyContext; import org.apache.maven.cli.event.ExecutionEventLogger; +import org.apache.maven.cli.logging.Slf4jConfiguration; import org.apache.maven.cli.logging.Slf4jLoggerManager; import org.apache.maven.cli.logging.Slf4jStdoutLogger; +import org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration; import org.apache.maven.cli.transfer.ConsoleMavenTransferListener; import org.apache.maven.cli.transfer.QuietMavenTransferListener; import org.apache.maven.cli.transfer.Slf4jMavenTransferListener; @@ -131,6 +133,8 @@ public class MavenCli private DefaultSecDispatcher dispatcher; + private Slf4jConfiguration slf4jConfiguration = new Slf4jSimpleConfiguration(); + public MavenCli() { this( null ); @@ -306,24 +310,24 @@ public class MavenCli if ( cliRequest.debug ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); - System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "debug" ); + slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); } else if ( cliRequest.quiet ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); - System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "error" ); + slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); } else { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO ); - System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", "info" ); + slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO ); } if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) { File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) ); logFile = resolveFile( logFile, cliRequest.workingDirectory ); - System.setProperty( "org.slf4j.simpleLogger.logFile", logFile.getAbsolutePath() ); + slf4jConfiguration.setLoggerFile( logFile ); try { PrintStream ps = new PrintStream( new FileOutputStream( logFile ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java new file mode 100644 index 0000000000..2b2ef6d288 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java @@ -0,0 +1,46 @@ +package org.apache.maven.cli.logging; + +/* + * 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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract implementation. + * + * @author Hervé Boutemy + */ +public class AbstractSlf4jConfiguration + implements Slf4jConfiguration +{ + private final Logger logger = LoggerFactory.getLogger( AbstractSlf4jConfiguration.class ); + + public void setRootLoggerLevel( int level ) + { + logger.warn( "setRootLoggerLevel: operation not supported" ); + } + + public void setLoggerFile( File output ) + { + logger.warn( "setLoggerFile: operation not supported" ); + } +} diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java new file mode 100644 index 0000000000..c988bd81a7 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -0,0 +1,35 @@ +package org.apache.maven.cli.logging; + +/* + * 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; + +/** + * Interface for configuration operations on loggers, which are not available in slf4j, then require per-slf4f-binding + * implementation. + * + * @author Hervé Boutemy + */ +public interface Slf4jConfiguration +{ + void setRootLoggerLevel( int level ); + + void setLoggerFile( File output ); +} diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java new file mode 100644 index 0000000000..c5d60d8df3 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -0,0 +1,62 @@ +package org.apache.maven.cli.logging.impl; + +/* + * 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.cli.logging.AbstractSlf4jConfiguration; +import org.apache.maven.cli.logging.Slf4jConfiguration; +import org.apache.maven.execution.MavenExecutionRequest; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Configuration for slf4j-simple. + * + * @author Hervé Boutemy + */ +@Component( role = Slf4jConfiguration.class ) +public class Slf4jSimpleConfiguration + extends AbstractSlf4jConfiguration +{ + public void setRootLoggerLevel( int level ) + { + String value = "info"; + switch ( level ) + { + case MavenExecutionRequest.LOGGING_LEVEL_DEBUG: + value = "debug"; + break; + + case MavenExecutionRequest.LOGGING_LEVEL_INFO: + value = "info"; + break; + + case MavenExecutionRequest.LOGGING_LEVEL_ERROR: + value = "error"; + break; + } + System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", value ); + } + + public void setLoggerFile( File output ) + { + System.setProperty( "org.slf4j.simpleLogger.logFile", output.getAbsolutePath() ); + } +} From aa0b71ca62eb095dd1476088b4071eaf269e7b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 09:44:26 +0100 Subject: [PATCH 051/102] improved javadoc --- .../main/java/org/apache/maven/cli/logging/Slf4jLogger.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java index a2b9bca5be..fa59a1275a 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java @@ -114,7 +114,7 @@ public class Slf4jLogger } /** - * Warning: ignored (always return 0). + * Warning: ignored (always return 0 == Logger.LEVEL_DEBUG). */ public int getThreshold() { @@ -129,7 +129,7 @@ public class Slf4jLogger } /** - * Warning: ignored (always return 0). + * Warning: ignored (always return null). */ public Logger getChildLogger( String name ) { From 25bae5acd7b1c9008182d45ddc54d8ba0ae9be7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 09:49:17 +0100 Subject: [PATCH 052/102] fixed indentation --- .../java/org/apache/maven/cli/MavenCli.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index e3c62f89d1..99ea11b8b9 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -387,29 +387,27 @@ public class MavenCli DefaultPlexusContainer container = null; - ContainerConfiguration cc = new DefaultContainerConfiguration() - .setClassWorld( cliRequest.classWorld ) - .setRealm( setupContainerRealm( cliRequest ) ) - .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) - .setAutoWiring( true ) - .setName( "maven" ); + ContainerConfiguration cc = new DefaultContainerConfiguration() + .setClassWorld( cliRequest.classWorld ) + .setRealm( setupContainerRealm( cliRequest ) ) + .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) + .setAutoWiring( true ) + .setName( "maven" ); - container = new DefaultPlexusContainer( cc, new AbstractModule() + container = new DefaultPlexusContainer( cc, new AbstractModule() + { + protected void configure() { + bind( ILoggerFactory.class ).toInstance( slf4jLoggerFactory ); + } + } ); - protected void configure() - { - bind( ILoggerFactory.class ).toInstance( slf4jLoggerFactory ); - } + // NOTE: To avoid inconsistencies, we'll use the TCCL exclusively for lookups + container.setLookupRealm( null ); - } ); + container.setLoggerManager( plexusLoggerManager ); - // NOTE: To avoid inconsistencies, we'll use the TCCL exclusively for lookups - container.setLookupRealm( null ); - - container.setLoggerManager( plexusLoggerManager ); - - customizeContainer( container ); + customizeContainer( container ); container.getLoggerManager().setThresholds( cliRequest.request.getLoggingLevel() ); From eb9257e70c4988fff66759ecdef806a6b82f2c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 11:21:30 +0100 Subject: [PATCH 053/102] added javadoc for logging levels int values accepted --- .../apache/maven/cli/logging/Slf4jConfiguration.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index c988bd81a7..8aff15a203 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -20,6 +20,8 @@ package org.apache.maven.cli.logging; */ import java.io.File; +import org.apache.maven.execution.MavenExecutionRequest; +import org.codehaus.plexus.logging.Logger; /** * Interface for configuration operations on loggers, which are not available in slf4j, then require per-slf4f-binding @@ -29,6 +31,14 @@ import java.io.File; */ public interface Slf4jConfiguration { + /** + * Set root logging level. + * + * @param level the level as defined in Plexus Logger LEVEL_* and equivalent + * MavenExecutionRequest.LOGGING_LEVEL_* constants. + * @see Logger + * @see MavenExecutionRequest + */ void setRootLoggerLevel( int level ); void setLoggerFile( File output ); From 3e95b5f1c775c26f84271d96bda0e726ee9d5169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 21:13:57 +0100 Subject: [PATCH 054/102] updated content --- apache-maven/NOTICE.txt | 2 +- apache-maven/README.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apache-maven/NOTICE.txt b/apache-maven/NOTICE.txt index 62abffbfa3..e744352531 100644 --- a/apache-maven/NOTICE.txt +++ b/apache-maven/NOTICE.txt @@ -5,7 +5,7 @@ ========================================================================= Apache Maven -Copyright 2001-2011 The Apache Software Foundation +Copyright 2001-2012 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). diff --git a/apache-maven/README.txt b/apache-maven/README.txt index c337ce8e6d..dc55c01f4f 100644 --- a/apache-maven/README.txt +++ b/apache-maven/README.txt @@ -40,18 +40,18 @@ 1) Unpack the archive where you would like to store the binaries, eg: Unix-based Operating Systems (Linux, Solaris and Mac OS X) - tar zxvf apache-maven-3.0.x.tar.gz + tar zxvf apache-maven-3.x.y.tar.gz Windows 2000/XP - unzip apache-maven-3.0.x.zip + unzip apache-maven-3.x.y.zip - 2) A directory called "apache-maven-3.0.x" will be created. + 2) A directory called "apache-maven-3.x.y" will be created. 3) Add the bin directory to your PATH, eg: Unix-based Operating Systems (Linux, Solaris and Mac OS X) - export PATH=/usr/local/apache-maven-3.0.x/bin:$PATH + export PATH=/usr/local/apache-maven-3.x.y/bin:$PATH Windows 2000/XP - set PATH="c:\program files\apache-maven-3.0.x\bin";%PATH% + set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH% 4) Make sure JAVA_HOME is set to the location of your JDK @@ -71,7 +71,7 @@ Downloads: http://maven.apache.org/download.html Release Notes: http://maven.apache.org/release-notes.html Mailing Lists: http://maven.apache.org/mail-lists.html - Source Code: http://svn.apache.org/repos/asf/maven/ + Source Code: https://git-wip-us.apache.org/repos/asf/maven.git/apache-maven Issue Tracking: http://jira.codehaus.org/browse/MNG - Wiki: http://docs.codehaus.org/display/MAVENUSER/ + Wiki: https://cwiki.apache.org/confluence/display/MAVEN/ Available Plugins: http://maven.apache.org/plugins/index.html From 7f21c4a31af5d499bc6242e4b1524db3348d7d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 21:15:26 +0100 Subject: [PATCH 055/102] improved javadoc --- .../java/org/apache/maven/cli/logging/Slf4jConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index 8aff15a203..e153c96959 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -34,7 +34,7 @@ public interface Slf4jConfiguration /** * Set root logging level. * - * @param level the level as defined in Plexus Logger LEVEL_* and equivalent + * @param level the level as defined in Plexus Logger.LEVEL_* and equivalent * MavenExecutionRequest.LOGGING_LEVEL_* constants. * @see Logger * @see MavenExecutionRequest From 2acec0557af502a0224ade17431dc2a23027acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 21:21:58 +0100 Subject: [PATCH 056/102] avoid timestamp in javadoc --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 7ed3df43f4..f53359f386 100644 --- a/pom.xml +++ b/pom.xml @@ -489,6 +489,7 @@ maven-javadoc-plugin true + true http://sonatype.github.com/sonatype-aether/apidocs/ http://plexus.codehaus.org/plexus-containers/plexus-container-default/apidocs/ From 3849bbd46a77c24aa72ec6949b5c96ad5e52847f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Dec 2012 21:49:18 +0100 Subject: [PATCH 057/102] fixed errors reported by Checkstyle --- .../versioning/ComparableVersion.java | 2 +- .../resolver/DefaultArtifactResolver.java | 8 ++-- .../transform/ArtifactTransformation.java | 11 ++--- .../ArtifactTransformationManager.java | 1 - .../DefaultMavenExecutionResult.java | 3 +- .../execution/MavenExecutionRequest.java | 28 +++++------ .../internal/CurrentPhaseForThread.java | 7 ++- ...faultLifecycleExecutionPlanCalculator.java | 46 ++++++++++--------- .../DefaultLifecyclePluginAnalyzer.java | 4 +- .../lifecycle/internal/ExecutionPlanItem.java | 4 +- .../internal/LifecycleWeaveBuilder.java | 3 +- 11 files changed, 59 insertions(+), 58 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java index 481e845d87..6f066140dc 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java @@ -86,7 +86,7 @@ public class ComparableVersion private static class IntegerItem implements Item { - private static final BigInteger BIG_INTEGER_ZERO = new BigInteger( "0" ); + private static final BigInteger BIG_INTEGER_ZERO = new BigInteger( "0" ); private final BigInteger value; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 18deeb2f5e..5833d06759 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -557,18 +557,18 @@ public class DefaultArtifactResolver /** * ThreadCreator for creating daemon threads with fixed ThreadGroup-name. */ - final static class DaemonThreadCreator + static final class DaemonThreadCreator implements ThreadFactory { static final String THREADGROUP_NAME = "org.apache.maven.artifact.resolver.DefaultArtifactResolver"; - final static ThreadGroup group = new ThreadGroup( THREADGROUP_NAME ); + static final ThreadGroup GROUP = new ThreadGroup( THREADGROUP_NAME ); - final static AtomicInteger threadNumber = new AtomicInteger( 1 ); + static final AtomicInteger THREAD_NUMBER = new AtomicInteger( 1 ); public Thread newThread( Runnable r ) { - Thread newThread = new Thread( group, r, "resolver-" + threadNumber.getAndIncrement() ); + Thread newThread = new Thread( GROUP, r, "resolver-" + THREAD_NUMBER.getAndIncrement() ); newThread.setDaemon( true ); return newThread; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java index 1a5606f2fa..42604d7549 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java @@ -38,18 +38,17 @@ public interface ArtifactTransformation /** * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occured the original artifact is returned. + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param request the repositories to check - * @param localRepository the local repository */ void transformForResolve( Artifact artifact, RepositoryRequest request ) throws ArtifactResolutionException, ArtifactNotFoundException; /** * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occured the original artifact is returned. + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param remoteRepositories the repositories to check @@ -62,7 +61,7 @@ public interface ArtifactTransformation /** * Take in a artifact and return the transformed artifact for locating in the local repository. If no - * transformation has occured the original artifact is returned. + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param localRepository the local repository it will be stored in @@ -72,8 +71,8 @@ public interface ArtifactTransformation throws ArtifactInstallationException; /** - * Take in a artifact and return the transformed artifact for distributing toa remote repository. If no - * transformation has occured the original artifact is returned. + * Take in a artifact and return the transformed artifact for distributing to remote repository. If no + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param remoteRepository the repository to deploy to diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java index 9137261532..f0ac9c89c8 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java @@ -40,7 +40,6 @@ public interface ArtifactTransformationManager * * @param artifact Artifact to be transformed. * @param request the repositories to check - * @param localRepository the local repository */ void transformForResolve( Artifact artifact, RepositoryRequest request ) throws ArtifactResolutionException, ArtifactNotFoundException; diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java index d2f8111fb7..cb22b3872c 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java @@ -19,7 +19,6 @@ package org.apache.maven.execution; * under the License. */ -import java.util.ArrayList; import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; @@ -39,7 +38,7 @@ public class DefaultMavenExecutionResult private DependencyResolutionResult dependencyResolutionResult; - private List exceptions = new CopyOnWriteArrayList( ); + private List exceptions = new CopyOnWriteArrayList(); private Map buildSummaries; diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index ef91ccf59a..ef88a1769f 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -45,45 +45,45 @@ public interface MavenExecutionRequest // Logging // ---------------------------------------------------------------------- - final int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG; + int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG; - final int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO; + int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO; - final int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN; + int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN; - final int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR; + int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR; - final int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL; + int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL; - final int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED; + int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED; // ---------------------------------------------------------------------- // Reactor Failure Mode // ---------------------------------------------------------------------- - final String REACTOR_FAIL_FAST = "FAIL_FAST"; + String REACTOR_FAIL_FAST = "FAIL_FAST"; - final String REACTOR_FAIL_AT_END = "FAIL_AT_END"; + String REACTOR_FAIL_AT_END = "FAIL_AT_END"; - final String REACTOR_FAIL_NEVER = "FAIL_NEVER"; + String REACTOR_FAIL_NEVER = "FAIL_NEVER"; // ---------------------------------------------------------------------- // Reactor Make Mode // ---------------------------------------------------------------------- - final String REACTOR_MAKE_UPSTREAM = "make-upstream"; + String REACTOR_MAKE_UPSTREAM = "make-upstream"; - final String REACTOR_MAKE_DOWNSTREAM = "make-downstream"; + String REACTOR_MAKE_DOWNSTREAM = "make-downstream"; - final String REACTOR_MAKE_BOTH = "make-both"; + String REACTOR_MAKE_BOTH = "make-both"; // ---------------------------------------------------------------------- // Artifact repository policies // ---------------------------------------------------------------------- - final String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL; + String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL; - final String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN; + String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN; // ---------------------------------------------------------------------- // diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CurrentPhaseForThread.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CurrentPhaseForThread.java index 548bfcab65..f05425336e 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CurrentPhaseForThread.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CurrentPhaseForThread.java @@ -29,17 +29,16 @@ package org.apache.maven.lifecycle.internal; */ class CurrentPhaseForThread { - private static final InheritableThreadLocal threadPhase = new InheritableThreadLocal(); - + private static final InheritableThreadLocal THREAD_PHASE = new InheritableThreadLocal(); public static void setPhase( String phase ) { - threadPhase.set( phase ); + THREAD_PHASE.set( phase ); } public static boolean isPhase( String phase ) { - return phase.equals( threadPhase.get() ); + return phase.equals( THREAD_PHASE.get() ); } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java index b28e6c0132..58a7a624af 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java @@ -1,19 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ package org.apache.maven.lifecycle.internal; +/* + * 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.IOException; import java.util.ArrayList; import java.util.Collection; @@ -219,11 +224,10 @@ public class DefaultLifecycleExecutionPlanCalculator if ( lifecycle == null ) { - throw new LifecyclePhaseNotFoundException( - "Unknown lifecycle phase \"" + lifecyclePhase + "\". You must specify a valid lifecycle phase" + - " or a goal in the format : or" + - " :[:]:. Available lifecycle phases are: " + - defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase ); + throw new LifecyclePhaseNotFoundException( "Unknown lifecycle phase \"" + lifecyclePhase + + "\". You must specify a valid lifecycle phase" + " or a goal in the format : or" + + " :[:]:. Available lifecycle phases are: " + + defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase ); } /* @@ -432,8 +436,8 @@ public class DefaultLifecycleExecutionPlanCalculator { parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() ); - if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) && - StringUtils.isNotEmpty( parameter.getImplementation() ) ) + if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) + && StringUtils.isNotEmpty( parameter.getImplementation() ) ) { parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java index afd0034119..a5e6a34c2e 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java @@ -80,8 +80,8 @@ public class DefaultLifecyclePluginAnalyzer { if ( logger.isDebugEnabled() ) { - logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from " + - Thread.currentThread().getContextClassLoader() ); + logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from " + + Thread.currentThread().getContextClassLoader() ); } LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging ); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java index 075524a632..027b241196 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java @@ -94,8 +94,8 @@ public class ExecutionPlanItem @Override public String toString() { - return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}' + - super.toString(); + return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}' + + super.toString(); } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java index 9447480817..4cfae7317c 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java @@ -212,7 +212,8 @@ public class LifecycleWeaveBuilder { Iterator planItems = executionPlan.iterator(); ExecutionPlanItem current = planItems.hasNext() ? planItems.next() : null; - ThreadLockedArtifact threadLockedArtifact = (ThreadLockedArtifact)projectBuild.getProject().getArtifact(); + ThreadLockedArtifact threadLockedArtifact = + (ThreadLockedArtifact) projectBuild.getProject().getArtifact(); if ( threadLockedArtifact != null ) { threadLockedArtifact.attachToThread(); From e950603218f6dcf45fdc8e456b2492a2d05ccb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 18 Dec 2012 04:11:57 +0100 Subject: [PATCH 058/102] is Slf4jConfiguration.setLoggerFile(File) API useful? --- .../src/main/java/org/apache/maven/cli/MavenCli.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 99ea11b8b9..eb440e482e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -298,9 +298,9 @@ public class MavenCli } } - // - // All logging is handled by SFL4J - // + /** + * configure logging + */ private void logging( CliRequest cliRequest ) { cliRequest.debug = cliRequest.commandLine.hasOption( CLIManager.DEBUG ); @@ -327,7 +327,8 @@ public class MavenCli { File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) ); logFile = resolveFile( logFile, cliRequest.workingDirectory ); - slf4jConfiguration.setLoggerFile( logFile ); + + // redirect stdout and stderr to file try { PrintStream ps = new PrintStream( new FileOutputStream( logFile ) ); @@ -340,6 +341,8 @@ public class MavenCli // Ignore // } + + slf4jConfiguration.setLoggerFile( logFile ); // is it really useful? redirecting stdout/stderr isn't sufficient in all cases? } plexusLoggerManager = new Slf4jLoggerManager(); From 8112e6a83544fe8acdd7efd973200157c1e7ca04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 18 Dec 2012 04:23:52 +0100 Subject: [PATCH 059/102] created Slf4jConfiguration.Level enum to replace int --- .../src/main/java/org/apache/maven/cli/MavenCli.java | 6 +++--- .../maven/cli/logging/AbstractSlf4jConfiguration.java | 2 +- .../apache/maven/cli/logging/Slf4jConfiguration.java | 11 ++++------- .../cli/logging/impl/Slf4jSimpleConfiguration.java | 9 ++++----- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index eb440e482e..23d2ba1dcd 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -310,17 +310,17 @@ public class MavenCli if ( cliRequest.debug ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); - slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); + slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.DEBUG ); } else if ( cliRequest.quiet ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); - slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); + slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.ERROR ); } else { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO ); - slf4jConfiguration.setRootLoggerLevel( MavenExecutionRequest.LOGGING_LEVEL_INFO ); + slf4jConfiguration.setRootLoggerLevel( Slf4jConfiguration.Level.INFO ); } if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) ) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java index 2b2ef6d288..4f89a94c5e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java @@ -34,7 +34,7 @@ public class AbstractSlf4jConfiguration { private final Logger logger = LoggerFactory.getLogger( AbstractSlf4jConfiguration.class ); - public void setRootLoggerLevel( int level ) + public void setRootLoggerLevel( Level level ) { logger.warn( "setRootLoggerLevel: operation not supported" ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index e153c96959..1ab596f44d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -20,8 +20,6 @@ package org.apache.maven.cli.logging; */ import java.io.File; -import org.apache.maven.execution.MavenExecutionRequest; -import org.codehaus.plexus.logging.Logger; /** * Interface for configuration operations on loggers, which are not available in slf4j, then require per-slf4f-binding @@ -31,15 +29,14 @@ import org.codehaus.plexus.logging.Logger; */ public interface Slf4jConfiguration { + public static enum Level { DEBUG, INFO, ERROR } + /** * Set root logging level. * - * @param level the level as defined in Plexus Logger.LEVEL_* and equivalent - * MavenExecutionRequest.LOGGING_LEVEL_* constants. - * @see Logger - * @see MavenExecutionRequest + * @param level the level */ - void setRootLoggerLevel( int level ); + void setRootLoggerLevel( Level level ); void setLoggerFile( File output ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index c5d60d8df3..56304c1556 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -23,7 +23,6 @@ import java.io.File; import org.apache.maven.cli.logging.AbstractSlf4jConfiguration; import org.apache.maven.cli.logging.Slf4jConfiguration; -import org.apache.maven.execution.MavenExecutionRequest; import org.codehaus.plexus.component.annotations.Component; /** @@ -35,20 +34,20 @@ import org.codehaus.plexus.component.annotations.Component; public class Slf4jSimpleConfiguration extends AbstractSlf4jConfiguration { - public void setRootLoggerLevel( int level ) + public void setRootLoggerLevel( Level level ) { String value = "info"; switch ( level ) { - case MavenExecutionRequest.LOGGING_LEVEL_DEBUG: + case DEBUG: value = "debug"; break; - case MavenExecutionRequest.LOGGING_LEVEL_INFO: + case INFO: value = "info"; break; - case MavenExecutionRequest.LOGGING_LEVEL_ERROR: + case ERROR: value = "error"; break; } From 9eeb0983805e804b1fef2e6a7be9cca92da1f3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 18 Dec 2012 04:35:08 +0100 Subject: [PATCH 060/102] can't be a Plexus component since Plexus container is not initialized at logging configuration time --- .../maven/cli/logging/impl/Slf4jSimpleConfiguration.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index 56304c1556..52887fca8c 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -22,15 +22,12 @@ package org.apache.maven.cli.logging.impl; import java.io.File; import org.apache.maven.cli.logging.AbstractSlf4jConfiguration; -import org.apache.maven.cli.logging.Slf4jConfiguration; -import org.codehaus.plexus.component.annotations.Component; /** * Configuration for slf4j-simple. * * @author Hervé Boutemy */ -@Component( role = Slf4jConfiguration.class ) public class Slf4jSimpleConfiguration extends AbstractSlf4jConfiguration { From eb190f029539efd95d5714298adb6752bf7ccf48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 18 Dec 2012 04:35:48 +0100 Subject: [PATCH 061/102] mark @Override --- .../apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index 52887fca8c..901239492d 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -31,6 +31,7 @@ import org.apache.maven.cli.logging.AbstractSlf4jConfiguration; public class Slf4jSimpleConfiguration extends AbstractSlf4jConfiguration { + @Override public void setRootLoggerLevel( Level level ) { String value = "info"; @@ -51,6 +52,7 @@ public class Slf4jSimpleConfiguration System.setProperty( "org.slf4j.simpleLogger.defaultLogLevel", value ); } + @Override public void setLoggerFile( File output ) { System.setProperty( "org.slf4j.simpleLogger.logFile", output.getAbsolutePath() ); From 3511b09d1e0fbea5a6e77593c297704a0b77600c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 18 Dec 2012 23:44:18 +0100 Subject: [PATCH 062/102] added Slf4jConfigurationFactory to detect actual slf4j logging implementation and load appropriate Slf4jConfiguration implementation from META-INF/maven/slf4j-configuration.properties --- .../java/org/apache/maven/cli/MavenCli.java | 8 +- ...ation.java => BaseSlf4jConfiguration.java} | 4 +- .../logging/Slf4jConfigurationFactory.java | 81 +++++++++++++++++++ .../impl/Slf4jSimpleConfiguration.java | 4 +- .../maven/slf4j-configuration.properties | 3 + 5 files changed, 92 insertions(+), 8 deletions(-) rename maven-embedder/src/main/java/org/apache/maven/cli/logging/{AbstractSlf4jConfiguration.java => BaseSlf4jConfiguration.java} (90%) create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java create mode 100644 maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 23d2ba1dcd..6737463768 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -40,9 +40,9 @@ import org.apache.maven.Maven; import org.apache.maven.cli.event.DefaultEventSpyContext; import org.apache.maven.cli.event.ExecutionEventLogger; import org.apache.maven.cli.logging.Slf4jConfiguration; +import org.apache.maven.cli.logging.Slf4jConfigurationFactory; import org.apache.maven.cli.logging.Slf4jLoggerManager; import org.apache.maven.cli.logging.Slf4jStdoutLogger; -import org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration; import org.apache.maven.cli.transfer.ConsoleMavenTransferListener; import org.apache.maven.cli.transfer.QuietMavenTransferListener; import org.apache.maven.cli.transfer.Slf4jMavenTransferListener; @@ -133,8 +133,6 @@ public class MavenCli private DefaultSecDispatcher dispatcher; - private Slf4jConfiguration slf4jConfiguration = new Slf4jSimpleConfiguration(); - public MavenCli() { this( null ); @@ -307,6 +305,9 @@ public class MavenCli cliRequest.quiet = !cliRequest.debug && cliRequest.commandLine.hasOption( CLIManager.QUIET ); cliRequest.showErrors = cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.ERRORS ); + slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); + Slf4jConfiguration slf4jConfiguration = Slf4jConfigurationFactory.getConfiguration( slf4jLoggerFactory ); + if ( cliRequest.debug ) { cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_DEBUG ); @@ -346,7 +347,6 @@ public class MavenCli } plexusLoggerManager = new Slf4jLoggerManager(); - slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java similarity index 90% rename from maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java rename to maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java index 4f89a94c5e..f82137eed8 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/AbstractSlf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java @@ -29,10 +29,10 @@ import org.slf4j.LoggerFactory; * * @author Hervé Boutemy */ -public class AbstractSlf4jConfiguration +public class BaseSlf4jConfiguration implements Slf4jConfiguration { - private final Logger logger = LoggerFactory.getLogger( AbstractSlf4jConfiguration.class ); + private final Logger logger = LoggerFactory.getLogger( BaseSlf4jConfiguration.class ); public void setRootLoggerLevel( Level level ) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java new file mode 100644 index 0000000000..2442a835f5 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfigurationFactory.java @@ -0,0 +1,81 @@ +package org.apache.maven.cli.logging; + +/* + * 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.IOException; +import java.net.URL; +import java.util.Enumeration; +import java.util.Properties; + +import org.codehaus.plexus.util.PropertyUtils; +import org.slf4j.ILoggerFactory; + +/** + * Slf4jConfiguration factory, loading implementations from META-INF/maven/slf4j-configuration.properties + * configuration files in class loader. + * + * @author Hervé Boutemy + */ +public class Slf4jConfigurationFactory +{ + public static final String RESOURCE = "META-INF/maven/slf4j-configuration.properties"; + + public static Slf4jConfiguration getConfiguration( ILoggerFactory loggerFactory ) + { + try + { + Enumeration resources = Slf4jConfigurationFactory.class.getClassLoader().getResources( RESOURCE ); + + String key = loggerFactory.getClass().getCanonicalName(); + + while ( resources.hasMoreElements() ) + { + URL resource = resources.nextElement(); + + Properties conf = PropertyUtils.loadProperties( resource.openStream() ); + + String impl = conf.getProperty( key ); + + if ( impl != null ) + { + return (Slf4jConfiguration) Class.forName( impl ).newInstance(); + } + } + } + catch ( IOException e ) + { + e.printStackTrace(); + } + catch ( InstantiationException e ) + { + e.printStackTrace(); + } + catch ( IllegalAccessException e ) + { + e.printStackTrace(); + } + catch ( ClassNotFoundException e ) + { + e.printStackTrace(); + } + + return new BaseSlf4jConfiguration(); + } +} diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index 901239492d..d2d8aa8212 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -21,7 +21,7 @@ package org.apache.maven.cli.logging.impl; import java.io.File; -import org.apache.maven.cli.logging.AbstractSlf4jConfiguration; +import org.apache.maven.cli.logging.BaseSlf4jConfiguration; /** * Configuration for slf4j-simple. @@ -29,7 +29,7 @@ import org.apache.maven.cli.logging.AbstractSlf4jConfiguration; * @author Hervé Boutemy */ public class Slf4jSimpleConfiguration - extends AbstractSlf4jConfiguration + extends BaseSlf4jConfiguration { @Override public void setRootLoggerLevel( Level level ) diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties new file mode 100644 index 0000000000..07d06e8aaa --- /dev/null +++ b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties @@ -0,0 +1,3 @@ +# key = Slf4j effective logger factory implementation +# value = corresponding o.a.m.cli.logging.Slf4jConfiguration class +org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration From 32699286999ee7c35bfe6f1768cce2732ceab337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 19 Dec 2012 00:09:04 +0100 Subject: [PATCH 063/102] added log4j2 configuration support --- .../cli/logging/impl/Log4j2Configuration.java | 60 +++++++++++++++++++ .../maven/slf4j-configuration.properties | 1 + 2 files changed, 61 insertions(+) create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java new file mode 100644 index 0000000000..c1d1275139 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java @@ -0,0 +1,60 @@ +package org.apache.maven.cli.logging.impl; + +/* + * 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.cli.logging.BaseSlf4jConfiguration; + +/** + * Configuration for slf4j-log4j2. + * + * @author Hervé Boutemy + */ +public class Log4j2Configuration + extends BaseSlf4jConfiguration +{ + @Override + public void setRootLoggerLevel( Level level ) + { + String value = "info"; + switch ( level ) + { + case DEBUG: + value = "debug"; + break; + + case INFO: + value = "info"; + break; + + case ERROR: + value = "error"; + break; + } + System.setProperty( "maven.logging.root.level", value ); + } + + @Override + public void setLoggerFile( File output ) + { + // no op + } +} diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties index 07d06e8aaa..150c15b7d4 100644 --- a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties +++ b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties @@ -1,3 +1,4 @@ # key = Slf4j effective logger factory implementation # value = corresponding o.a.m.cli.logging.Slf4jConfiguration class org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration +org.slf4j.helpers.Log4JLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration \ No newline at end of file From 0ab0641d3f1db429e00079a91564dd4d3b5b5072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 19 Dec 2012 00:36:27 +0100 Subject: [PATCH 064/102] added Logback support --- maven-embedder/pom.xml | 6 ++ .../logging/impl/LogbackConfiguration.java | 62 +++++++++++++++++++ .../maven/slf4j-configuration.properties | 3 +- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 587398f371..c95eb8739b 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -74,6 +74,12 @@ org.slf4j slf4j-api + + ch.qos.logback + logback-classic + 1.0.7 + true + commons-cli diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java new file mode 100644 index 0000000000..2d60b75df4 --- /dev/null +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java @@ -0,0 +1,62 @@ +package org.apache.maven.cli.logging.impl; + +/* + * 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.cli.logging.BaseSlf4jConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Configuration for slf4j-logback. + * + * @author Hervé Boutemy + */ +public class LogbackConfiguration + extends BaseSlf4jConfiguration +{ + @Override + public void setRootLoggerLevel( Level level ) + { + ch.qos.logback.classic.Level value = ch.qos.logback.classic.Level.INFO; + switch ( level ) + { + case DEBUG: + value = ch.qos.logback.classic.Level.DEBUG; + break; + + case INFO: + value = ch.qos.logback.classic.Level.INFO; + break; + + case ERROR: + value = ch.qos.logback.classic.Level.ERROR; + break; + } + ( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value ); + } + + @Override + public void setLoggerFile( File output ) + { + // no op + } +} diff --git a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties index 150c15b7d4..5a6a12f765 100644 --- a/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties +++ b/maven-embedder/src/main/resources/META-INF/maven/slf4j-configuration.properties @@ -1,4 +1,5 @@ # key = Slf4j effective logger factory implementation # value = corresponding o.a.m.cli.logging.Slf4jConfiguration class org.slf4j.impl.SimpleLoggerFactory org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration -org.slf4j.helpers.Log4JLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration \ No newline at end of file +org.slf4j.helpers.Log4JLoggerFactory org.apache.maven.cli.logging.impl.Log4j2Configuration +ch.qos.logback.classic.LoggerContext org.apache.maven.cli.logging.impl.LogbackConfiguration From 547b8c4c30d28acd9913f21e62cfd2a44681a66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 20 Dec 2012 08:49:02 +0100 Subject: [PATCH 065/102] fix bootstrap (with Ant) --- maven-embedder/pom.xml | 1 - pom.xml | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index c95eb8739b..5fb96dced1 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -77,7 +77,6 @@ ch.qos.logback logback-classic - 1.0.7 true diff --git a/pom.xml b/pom.xml index f53359f386..91f918b1b7 100644 --- a/pom.xml +++ b/pom.xml @@ -162,6 +162,11 @@ maven-repository-metadata ${project.version} + + ch.qos.logback + logback-classic + 1.0.7 + From c5f54f8a6a842af1cc506d9f90ad169b617ba686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 20 Dec 2012 08:58:13 +0100 Subject: [PATCH 066/102] fixed bootstrap (really, this time) --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 91f918b1b7..6b0fa21ae9 100644 --- a/pom.xml +++ b/pom.xml @@ -162,11 +162,6 @@ maven-repository-metadata ${project.version} - - ch.qos.logback - logback-classic - 1.0.7 - @@ -218,6 +213,11 @@ ${slf4jVersion} runtime + + ch.qos.logback + logback-classic + 1.0.7 + org.apache.maven.wagon From 11ac804f59eb529e914c57caae8f52d9a1f3e5a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Fri, 21 Dec 2012 07:49:50 +0100 Subject: [PATCH 067/102] added bootstrap files to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index adc6c00321..432006ec5a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ bin/ .idea .DS_Store +/bootstrap +/dependencies.xml From 57d9c68e56a4bc8d825c7615534023eeda52b9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Fri, 21 Dec 2012 07:50:56 +0100 Subject: [PATCH 068/102] stdout/stderr redirection should be sufficient --- .../apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index d2d8aa8212..f463dd8a6f 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -55,6 +55,6 @@ public class Slf4jSimpleConfiguration @Override public void setLoggerFile( File output ) { - System.setProperty( "org.slf4j.simpleLogger.logFile", output.getAbsolutePath() ); + //System.setProperty( "org.slf4j.simpleLogger.logFile", output.getAbsolutePath() ); } } From 89c2524458dd76634c5e3e9b278b34bcfe6e0ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 5 Jan 2013 10:29:49 +0100 Subject: [PATCH 069/102] ${basedir} is deprecated --- maven-model-builder/src/site/apt/index.apt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt index 0b604c9edb..de62edc942 100644 --- a/maven-model-builder/src/site/apt/index.apt +++ b/maven-model-builder/src/site/apt/index.apt @@ -91,9 +91,9 @@ Maven Model Builder | | <<<$\{project.build.artifactId\}>>>\ | | <<<$\{project.build.directory\}>>> | *----+------+------+ -| <<>>\ -<<>>\ -<<>> () | the directory containing the <<>> file | <<<$\{project.basedir\}>>> | +| <<>>\ +<<>> ()\ +<<>> () | the directory containing the <<>> file | <<<$\{project.basedir\}>>> | *----+------+------+ | <<>>\ <<>> () | the directory containing the <<>> file as URI | <<<$\{project.baseUri\}>>> | From 72bdc8602e5112aa273adc46b06d41c41f0f64a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 6 Jan 2013 11:50:25 +0100 Subject: [PATCH 070/102] added slf4j-simple logging configuration reinitialization to have Core ITs run without errors --- maven-embedder/pom.xml | 5 +++ .../java/org/apache/maven/cli/MavenCli.java | 4 +-- .../cli/logging/BaseSlf4jConfiguration.java | 6 ++-- .../maven/cli/logging/Slf4jConfiguration.java | 7 ++-- .../cli/logging/impl/Log4j2Configuration.java | 4 +-- .../logging/impl/LogbackConfiguration.java | 4 +-- .../impl/Slf4jSimpleConfiguration.java | 10 +++--- .../main/java/org/slf4j/MavenSlf4jFriend.java | 35 +++++++++++++++++++ .../slf4j/impl/MavenSlf4jSimpleFriend.java | 32 +++++++++++++++++ pom.xml | 3 +- 10 files changed, 90 insertions(+), 20 deletions(-) create mode 100644 maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java create mode 100644 maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 5fb96dced1..49a7b57629 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -74,6 +74,11 @@ org.slf4j slf4j-api + + org.slf4j + slf4j-simple + true + ch.qos.logback logback-classic diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 6737463768..5a4710fd04 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -342,10 +342,10 @@ public class MavenCli // Ignore // } - - slf4jConfiguration.setLoggerFile( logFile ); // is it really useful? redirecting stdout/stderr isn't sufficient in all cases? } + slf4jConfiguration.activate(); + plexusLoggerManager = new Slf4jLoggerManager(); slf4jLogger = slf4jLoggerFactory.getLogger( this.getClass().getName() ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java index f82137eed8..a6961848db 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/BaseSlf4jConfiguration.java @@ -19,8 +19,6 @@ package org.apache.maven.cli.logging; * under the License. */ -import java.io.File; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,8 +37,8 @@ public class BaseSlf4jConfiguration logger.warn( "setRootLoggerLevel: operation not supported" ); } - public void setLoggerFile( File output ) + public void activate() { - logger.warn( "setLoggerFile: operation not supported" ); + logger.warn( "reset(): operation not supported" ); } } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java index 1ab596f44d..661c9e3eb4 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jConfiguration.java @@ -19,8 +19,6 @@ package org.apache.maven.cli.logging; * under the License. */ -import java.io.File; - /** * Interface for configuration operations on loggers, which are not available in slf4j, then require per-slf4f-binding * implementation. @@ -38,5 +36,8 @@ public interface Slf4jConfiguration */ void setRootLoggerLevel( Level level ); - void setLoggerFile( File output ); + /** + * Activate logging implementation configuration (if necessary). + */ + void activate(); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java index c1d1275139..9cec3ccb80 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Log4j2Configuration.java @@ -19,8 +19,6 @@ package org.apache.maven.cli.logging.impl; * under the License. */ -import java.io.File; - import org.apache.maven.cli.logging.BaseSlf4jConfiguration; /** @@ -53,7 +51,7 @@ public class Log4j2Configuration } @Override - public void setLoggerFile( File output ) + public void activate() { // no op } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java index 2d60b75df4..b72940a3a7 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java @@ -19,8 +19,6 @@ package org.apache.maven.cli.logging.impl; * under the License. */ -import java.io.File; - import org.apache.maven.cli.logging.BaseSlf4jConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +53,7 @@ public class LogbackConfiguration } @Override - public void setLoggerFile( File output ) + public void activate() { // no op } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java index f463dd8a6f..6a7f38518e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/Slf4jSimpleConfiguration.java @@ -19,9 +19,9 @@ package org.apache.maven.cli.logging.impl; * under the License. */ -import java.io.File; - import org.apache.maven.cli.logging.BaseSlf4jConfiguration; +import org.slf4j.MavenSlf4jFriend; +import org.slf4j.impl.MavenSlf4jSimpleFriend; /** * Configuration for slf4j-simple. @@ -53,8 +53,10 @@ public class Slf4jSimpleConfiguration } @Override - public void setLoggerFile( File output ) + public void activate() { - //System.setProperty( "org.slf4j.simpleLogger.logFile", output.getAbsolutePath() ); + // property for root logger level or System.out redirection need to be taken into account + MavenSlf4jFriend.reset(); + MavenSlf4jSimpleFriend.init(); } } diff --git a/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java b/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java new file mode 100644 index 0000000000..8a43053708 --- /dev/null +++ b/maven-embedder/src/main/java/org/slf4j/MavenSlf4jFriend.java @@ -0,0 +1,35 @@ +package org.slf4j; + +/* + * 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. + */ + +/** + * Utility for Maven to access Slf4j internals through package access. + * Use with precaution, since this is not normally intended for production use. + */ +public class MavenSlf4jFriend +{ + /** + * Reset Slf4j internal state. + */ + public static void reset() + { + LoggerFactory.reset(); + } +} diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java new file mode 100644 index 0000000000..097ad68879 --- /dev/null +++ b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java @@ -0,0 +1,32 @@ +package org.slf4j.impl; + +/* + * 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. + */ + +/** + * Utility for Maven to access Slf4j-Simple internals through package access. + * Use with precaution, since this is not normally intended for production use. + */ +public class MavenSlf4jSimpleFriend +{ + public static void init() + { + SimpleLogger.init(); + } +} diff --git a/pom.xml b/pom.xml index 6b0fa21ae9..68dec80e94 100644 --- a/pom.xml +++ b/pom.xml @@ -211,12 +211,13 @@ org.slf4j slf4j-simple ${slf4jVersion} - runtime + true ch.qos.logback logback-classic 1.0.7 + true From 77b12f962d002ab887dd17b5aeef198fd410be8f Mon Sep 17 00:00:00 2001 From: Anders Hammar Date: Mon, 7 Jan 2013 11:35:57 +0100 Subject: [PATCH 071/102] Fixed incorrect Maven property example. Signed-off-by: Anders Hammar --- maven-model-builder/src/site/apt/index.apt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt index de62edc942..1943d7bded 100644 --- a/maven-model-builder/src/site/apt/index.apt +++ b/maven-model-builder/src/site/apt/index.apt @@ -88,7 +88,7 @@ Maven Model Builder <<>> ()\ <<<*>>> () | POM content (see {{{../maven-model/maven.html}POM reference}}) | <<<$\{project.version\}>>>\ | | <<<$\{project.build.finalName\}>>>\ - | | <<<$\{project.build.artifactId\}>>>\ + | | <<<$\{project.artifactId\}>>>\ | | <<<$\{project.build.directory\}>>> | *----+------+------+ | <<>>\ From b6e99c76764985ae5cbe2e70730ff04a2a2672a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 12 Jan 2013 09:08:05 +0100 Subject: [PATCH 072/102] added javadoc --- .../src/main/java/org/apache/maven/artifact/Artifact.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java index 338c612d05..b26ad9f42b 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java @@ -32,6 +32,10 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.VersionRange; +/** + * Maven Artifact interface. Notice that it mixes artifact definition concepts (groupId, artifactId, version) + * with dependency information (version range, scope). + */ public interface Artifact extends Comparable { From 5ad8e34e6330ed6899564e1302357679cc36465a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 17 Jan 2013 22:00:49 +0100 Subject: [PATCH 073/102] improved javadoc --- .../maven/repository/internal/DefaultVersionResolver.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index cdc0252933..e31e94e9f1 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -68,7 +68,13 @@ import org.sonatype.aether.util.listener.DefaultRepositoryEvent; import org.sonatype.aether.util.metadata.DefaultMetadata; /** + * Maven version resolver: supports *-SNAPSHOT, RELEASE and LATEST + * meta-version resolution from + * versioning + * element in repositories' maven-metadata.xml. + * * @author Benjamin Bentmann + * @see Versioning */ @Component( role = VersionResolver.class ) public class DefaultVersionResolver From 0824df85f3fbe8ec08ec787749fffdf4b3a8ea21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 17 Jan 2013 22:04:09 +0100 Subject: [PATCH 074/102] little code simplification --- .../repository/internal/DefaultVersionResolver.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index e31e94e9f1..f360e33e7b 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -68,7 +68,7 @@ import org.sonatype.aether.util.listener.DefaultRepositoryEvent; import org.sonatype.aether.util.metadata.DefaultMetadata; /** - * Maven version resolver: supports *-SNAPSHOT, RELEASE and LATEST + * Maven meta-version resolver: supports *-SNAPSHOT, RELEASE and LATEST * meta-version resolution from * versioning * element in repositories' maven-metadata.xml. @@ -293,11 +293,11 @@ public class DefaultVersionResolver { throw new VersionResolutionException( result ); } - } - if ( cacheKey != null && metadata != null && isSafelyCacheable( session, artifact ) ) - { - cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) ); + if ( cacheKey != null && isSafelyCacheable( session, artifact ) ) + { + cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) ); + } } return result; From d22d94903ae67ea271d9bd52fc7765e595cd6361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 17 Jan 2013 22:56:18 +0100 Subject: [PATCH 075/102] code simplification --- .../internal/DefaultVersionResolver.java | 93 +++++++++++-------- 1 file changed, 52 insertions(+), 41 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index f360e33e7b..24e9531b57 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -22,6 +22,7 @@ package org.apache.maven.repository.internal; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -36,6 +37,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.sonatype.aether.RepositoryCache; import org.sonatype.aether.RepositoryEvent.EventType; import org.sonatype.aether.RepositorySystemSession; @@ -149,8 +151,6 @@ public class DefaultVersionResolver public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request ) throws VersionResolutionException { - RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request ); - Artifact artifact = request.getArtifact(); String version = artifact.getVersion(); @@ -219,6 +219,8 @@ public class DefaultVersionResolver metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) ); + RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request ); + for ( RemoteRepository repository : request.getRepositories() ) { MetadataRequest metadataRequest = @@ -319,50 +321,35 @@ public class DefaultVersionResolver { Versioning versioning = null; - FileInputStream fis = null; + SyncContext syncContext = syncContextFactory.newInstance( session, true ); + try { - if ( metadata != null ) + syncContext.acquire( null, Collections.singleton( metadata ) ); + + versioning = readMavenRepositoryMetadataVersioning( metadata.getFile() ); + + /* + * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata + * of the local repository. This is especially troublesome during snapshot resolution so we try + * to handle that gracefully. + */ + if ( versioning != null && repository instanceof LocalRepository ) { - SyncContext syncContext = syncContextFactory.newInstance( session, true ); - - try + Snapshot snapshot = versioning.getSnapshot(); + if ( snapshot != null && snapshot.getBuildNumber() > 0 ) { - syncContext.acquire( null, Collections.singleton( metadata ) ); + Versioning repaired = new Versioning(); + repaired.setLastUpdated( versioning.getLastUpdated() ); + snapshot = new Snapshot(); + snapshot.setLocalCopy( true ); + repaired.setSnapshot( snapshot ); - if ( metadata.getFile() != null && metadata.getFile().exists() ) - { - fis = new FileInputStream( metadata.getFile() ); - org.apache.maven.artifact.repository.metadata.Metadata m = - new MetadataXpp3Reader().read( fis, false ); - versioning = m.getVersioning(); + versioning = repaired; - /* - * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata - * of the local repository. This is especially troublesome during snapshot resolution so we try - * to handle that gracefully. - */ - if ( versioning != null && repository instanceof LocalRepository ) - { - if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 ) - { - Versioning repaired = new Versioning(); - repaired.setLastUpdated( versioning.getLastUpdated() ); - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy( true ); - repaired.setSnapshot( snapshot ); - versioning = repaired; - - throw new IOException( "Snapshot information corrupted with remote repository data" - + ", please verify that no remote repository uses the id '" + repository.getId() - + "'" ); - } - } - } - } - finally - { - syncContext.release(); + throw new IOException( "Snapshot information corrupted with remote repository data" + + ", please verify that no remote repository uses the id '" + repository.getId() + + "'" ); } } } @@ -373,12 +360,36 @@ public class DefaultVersionResolver } finally { - IOUtil.close( fis ); + syncContext.release(); } return ( versioning != null ) ? versioning : new Versioning(); } + private Versioning readMavenRepositoryMetadataVersioning( File metadataFile ) + throws IOException, XmlPullParserException + { + if ( metadataFile == null ||! metadataFile.exists() ) + { + return null; + } + + InputStream is = null; + try + { + is = new FileInputStream( metadataFile ); + + MetadataXpp3Reader reader = new MetadataXpp3Reader(); + org.apache.maven.artifact.repository.metadata.Metadata m = reader.read( is, false ); + + return m.getVersioning(); + } + finally + { + IOUtil.close( is ); + } + } + private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata, ArtifactRepository repository, Exception exception ) { From ff21286eee17e611daa4bc87afe856b7af627b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 17 Jan 2013 23:22:58 +0100 Subject: [PATCH 076/102] extracted readVersionInfoMap method --- .../internal/DefaultVersionResolver.java | 199 +++++++++--------- 1 file changed, 99 insertions(+), 100 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index 24e9531b57..eca718ed43 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -175,136 +175,135 @@ public class DefaultVersionResolver } } - Metadata metadata; - if ( RELEASE.equals( version ) ) { - metadata = - new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML, - Metadata.Nature.RELEASE ); + Map infos = readVersionInfoMap( session, result, Metadata.Nature.RELEASE, null ); + + resolve( result, infos, RELEASE ); } else if ( LATEST.equals( version ) ) { - metadata = - new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML, - Metadata.Nature.RELEASE_OR_SNAPSHOT ); + Map infos = + readVersionInfoMap( session, result, Metadata.Nature.RELEASE_OR_SNAPSHOT, null ); + + if ( !resolve( result, infos, LATEST ) ) + { + resolve( result, infos, RELEASE ); + } + + if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) ) + { + VersionRequest subRequest = new VersionRequest(); + subRequest.setArtifact( artifact.setVersion( result.getVersion() ) ); + if ( result.getRepository() instanceof RemoteRepository ) + { + subRequest.setRepositories( Collections.singletonList( (RemoteRepository) result.getRepository() ) ); + } + else + { + subRequest.setRepositories( request.getRepositories() ); + } + VersionResult subResult = resolveVersion( session, subRequest ); + result.setVersion( subResult.getVersion() ); + result.setRepository( subResult.getRepository() ); + for ( Exception exception : subResult.getExceptions() ) + { + result.addException( exception ); + } + } } else if ( version.endsWith( SNAPSHOT ) ) { WorkspaceReader workspace = session.getWorkspaceReader(); if ( workspace != null && workspace.findVersions( artifact ).contains( version ) ) { - metadata = null; + result.setVersion( version ); result.setRepository( workspace.getRepository() ); + + return result; } else { - metadata = - new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML, - Metadata.Nature.SNAPSHOT ); - } - } - else - { - metadata = null; - } + Map infos = + readVersionInfoMap( session, result, Metadata.Nature.SNAPSHOT, version ); - if ( metadata == null ) - { - result.setVersion( version ); - } - else - { - List metadataRequests = new ArrayList( request.getRepositories().size() ); - - metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) ); - - RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request ); - - for ( RemoteRepository repository : request.getRepositories() ) - { - MetadataRequest metadataRequest = - new MetadataRequest( metadata, repository, request.getRequestContext() ); - metadataRequest.setDeleteLocalCopyIfMissing( true ); - metadataRequest.setFavorLocalRepository( true ); - metadataRequest.setTrace( trace ); - metadataRequests.add( metadataRequest ); - } - - List metadataResults = metadataResolver.resolveMetadata( session, metadataRequests ); - - Map infos = new HashMap(); - - for ( MetadataResult metadataResult : metadataResults ) - { - result.addException( metadataResult.getException() ); - - ArtifactRepository repository = metadataResult.getRequest().getRepository(); - if ( repository == null ) - { - repository = session.getLocalRepository(); - } - - Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result ); - merge( artifact, infos, versioning, repository ); - } - - if ( RELEASE.equals( version ) ) - { - resolve( result, infos, RELEASE ); - } - else if ( LATEST.equals( version ) ) - { - if ( !resolve( result, infos, LATEST ) ) - { - resolve( result, infos, RELEASE ); - } - - if ( result.getVersion() != null && result.getVersion().endsWith( SNAPSHOT ) ) - { - VersionRequest subRequest = new VersionRequest(); - subRequest.setArtifact( artifact.setVersion( result.getVersion() ) ); - if ( result.getRepository() instanceof RemoteRepository ) - { - subRequest.setRepositories( Collections.singletonList( (RemoteRepository) result.getRepository() ) ); - } - else - { - subRequest.setRepositories( request.getRepositories() ); - } - VersionResult subResult = resolveVersion( session, subRequest ); - result.setVersion( subResult.getVersion() ); - result.setRepository( subResult.getRepository() ); - for ( Exception exception : subResult.getExceptions() ) - { - result.addException( exception ); - } - } - } - else - { String key = SNAPSHOT + getKey( artifact.getClassifier(), artifact.getExtension() ); + merge( infos, SNAPSHOT, key ); + if ( !resolve( result, infos, key ) ) { result.setVersion( version ); } } + } + else + { + result.setVersion( version ); - if ( StringUtils.isEmpty( result.getVersion() ) ) - { - throw new VersionResolutionException( result ); - } + return result; + } - if ( cacheKey != null && isSafelyCacheable( session, artifact ) ) - { - cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) ); - } + if ( StringUtils.isEmpty( result.getVersion() ) ) + { + throw new VersionResolutionException( result ); + } + + if ( cacheKey != null && isSafelyCacheable( session, artifact ) ) + { + cache.put( session, cacheKey, new Record( result.getVersion(), result.getRepository() ) ); } return result; } + private Map readVersionInfoMap( RepositorySystemSession session, VersionResult result, + Metadata.Nature nature, String version ) + { + VersionRequest request = result.getRequest(); + Artifact artifact = request.getArtifact(); + + Metadata metadata = + new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML, nature ); + + RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request ); + + List metadataRequests = new ArrayList( request.getRepositories().size() + 1 ); + + metadataRequests.add( new MetadataRequest( metadata, null, request.getRequestContext() ) ); + + for ( RemoteRepository repository : request.getRepositories() ) + { + MetadataRequest metadataRequest = new MetadataRequest( metadata, repository, request.getRequestContext() ); + metadataRequest.setDeleteLocalCopyIfMissing( true ); + metadataRequest.setFavorLocalRepository( true ); + metadataRequest.setTrace( trace ); + + metadataRequests.add( metadataRequest ); + } + + List metadataResults = metadataResolver.resolveMetadata( session, metadataRequests ); + + Map infos = new HashMap(); + + for ( MetadataResult metadataResult : metadataResults ) + { + result.addException( metadataResult.getException() ); + + ArtifactRepository repository = metadataResult.getRequest().getRepository(); + if ( repository == null ) + { + repository = session.getLocalRepository(); + } + + Versioning versioning = readVersions( session, trace, metadataResult.getMetadata(), repository, result ); + + merge( request.getArtifact(), infos, versioning, repository ); + } + + return infos; + } + private boolean resolve( VersionResult result, Map infos, String key ) { VersionInfo info = infos.get( key ); From 66dc8c6ec1125436f502366942da622ee7f8f0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Fri, 18 Jan 2013 00:44:02 +0100 Subject: [PATCH 077/102] code simplification --- .../internal/DefaultVersionRangeResolver.java | 47 ++++++------------- .../internal/DefaultVersionResolver.java | 2 +- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java index c5b85f709a..26dca40be3 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java @@ -19,7 +19,6 @@ package org.apache.maven.repository.internal; * under the License. */ -import java.io.FileInputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -27,10 +26,8 @@ import java.util.List; import java.util.Map; import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.IOUtil; import org.sonatype.aether.RepositoryEvent.EventType; import org.sonatype.aether.RepositorySystemSession; import org.sonatype.aether.RequestTrace; @@ -244,39 +241,25 @@ public class DefaultVersionRangeResolver { Versioning versioning = null; - FileInputStream fis = null; - try + if ( metadata != null ) { - if ( metadata != null ) + SyncContext syncContext = syncContextFactory.newInstance( session, true ); + + try { - SyncContext syncContext = syncContextFactory.newInstance( session, true ); + syncContext.acquire( null, Collections.singleton( metadata ) ); - try - { - syncContext.acquire( null, Collections.singleton( metadata ) ); - - if ( metadata.getFile() != null && metadata.getFile().exists() ) - { - fis = new FileInputStream( metadata.getFile() ); - org.apache.maven.artifact.repository.metadata.Metadata m = - new MetadataXpp3Reader().read( fis, false ); - versioning = m.getVersioning(); - } - } - finally - { - syncContext.release(); - } + versioning = DefaultVersionResolver.readMavenRepositoryMetadataVersioning( metadata.getFile() ); + } + catch ( Exception e ) + { + invalidMetadata( session, trace, metadata, repository, e ); + result.addException( e ); + } + finally + { + syncContext.release(); } - } - catch ( Exception e ) - { - invalidMetadata( session, trace, metadata, repository, e ); - result.addException( e ); - } - finally - { - IOUtil.close( fis ); } return ( versioning != null ) ? versioning : new Versioning(); diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index eca718ed43..daed903bbc 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -365,7 +365,7 @@ public class DefaultVersionResolver return ( versioning != null ) ? versioning : new Versioning(); } - private Versioning readMavenRepositoryMetadataVersioning( File metadataFile ) + static Versioning readMavenRepositoryMetadataVersioning( File metadataFile ) throws IOException, XmlPullParserException { if ( metadataFile == null ||! metadataFile.exists() ) From 9a1d22fa40a5c4f190716c11bea127308dad8b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 19 Jan 2013 08:56:12 +0100 Subject: [PATCH 078/102] move MAVEN_METADATA_XML constant to MavenMetadata class --- .../repository/internal/DefaultVersionRangeResolver.java | 5 +---- .../maven/repository/internal/DefaultVersionResolver.java | 6 ++---- .../org/apache/maven/repository/internal/MavenMetadata.java | 4 +++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java index 26dca40be3..d2c87745ca 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java @@ -66,9 +66,6 @@ public class DefaultVersionRangeResolver implements VersionRangeResolver, Service { - private static final String MAVEN_METADATA_XML = "maven-metadata.xml"; - - @SuppressWarnings( "unused" ) @Requirement private Logger logger = NullLogger.INSTANCE; @@ -187,7 +184,7 @@ public class DefaultVersionRangeResolver Metadata metadata = new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(), - MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT ); + MavenMetadata.MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT ); List metadataRequests = new ArrayList( request.getRepositories().size() ); diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index daed903bbc..a9146d7fd7 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -83,15 +83,12 @@ public class DefaultVersionResolver implements VersionResolver, Service { - private static final String MAVEN_METADATA_XML = "maven-metadata.xml"; - private static final String RELEASE = "RELEASE"; private static final String LATEST = "LATEST"; private static final String SNAPSHOT = "SNAPSHOT"; - @SuppressWarnings( "unused" ) @Requirement private Logger logger = NullLogger.INSTANCE; @@ -264,7 +261,8 @@ public class DefaultVersionResolver Artifact artifact = request.getArtifact(); Metadata metadata = - new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML, nature ); + new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, + MavenMetadata.MAVEN_METADATA_XML, nature ); RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request ); diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java index 3db90e94fd..1fdfad7f82 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java @@ -41,6 +41,8 @@ abstract class MavenMetadata implements MergeableMetadata { + static final String MAVEN_METADATA_XML = "maven-metadata.xml"; + private final File file; protected Metadata metadata; @@ -55,7 +57,7 @@ abstract class MavenMetadata public String getType() { - return "maven-metadata.xml"; + return MAVEN_METADATA_XML; } public File getFile() From 1408254fb863a2417cd9f463f27a3e89947f3bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 19 Jan 2013 09:04:29 +0100 Subject: [PATCH 079/102] use MavenMetadata.read(File) API instead of duplicating code --- .../internal/DefaultVersionRangeResolver.java | 2 +- .../internal/DefaultVersionResolver.java | 31 +------------------ .../repository/internal/MavenMetadata.java | 2 +- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java index d2c87745ca..87c69fb0d0 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java @@ -246,7 +246,7 @@ public class DefaultVersionRangeResolver { syncContext.acquire( null, Collections.singleton( metadata ) ); - versioning = DefaultVersionResolver.readMavenRepositoryMetadataVersioning( metadata.getFile() ); + versioning = MavenMetadata.read( metadata.getFile() ).getVersioning(); } catch ( Exception e ) { diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index a9146d7fd7..759d90ec82 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -20,9 +20,7 @@ package org.apache.maven.repository.internal; */ import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -32,12 +30,9 @@ import java.util.Map; import org.apache.maven.artifact.repository.metadata.Snapshot; import org.apache.maven.artifact.repository.metadata.SnapshotVersion; import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.sonatype.aether.RepositoryCache; import org.sonatype.aether.RepositoryEvent.EventType; import org.sonatype.aether.RepositorySystemSession; @@ -324,7 +319,7 @@ public class DefaultVersionResolver { syncContext.acquire( null, Collections.singleton( metadata ) ); - versioning = readMavenRepositoryMetadataVersioning( metadata.getFile() ); + versioning = MavenMetadata.read( metadata.getFile() ).getVersioning(); /* * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata @@ -363,30 +358,6 @@ public class DefaultVersionResolver return ( versioning != null ) ? versioning : new Versioning(); } - static Versioning readMavenRepositoryMetadataVersioning( File metadataFile ) - throws IOException, XmlPullParserException - { - if ( metadataFile == null ||! metadataFile.exists() ) - { - return null; - } - - InputStream is = null; - try - { - is = new FileInputStream( metadataFile ); - - MetadataXpp3Reader reader = new MetadataXpp3Reader(); - org.apache.maven.artifact.repository.metadata.Metadata m = reader.read( is, false ); - - return m.getVersioning(); - } - finally - { - IOUtil.close( is ); - } - } - private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata, ArtifactRepository repository, Exception exception ) { diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java index 1fdfad7f82..78be415fc7 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenMetadata.java @@ -84,7 +84,7 @@ abstract class MavenMetadata protected abstract void merge( Metadata recessive ); - private Metadata read( File metadataFile ) + static Metadata read( File metadataFile ) throws RepositoryException { if ( metadataFile.length() <= 0 ) From 37d3166d00a4f5fee06c2e14d20b5c7292d84eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 19 Jan 2013 09:22:56 +0100 Subject: [PATCH 080/102] removed unused annotation --- .../repository/internal/DefaultArtifactDescriptorReader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java index 1faee29754..a86428b028 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java @@ -88,7 +88,6 @@ public class DefaultArtifactDescriptorReader implements ArtifactDescriptorReader, Service { - @SuppressWarnings( "unused" ) @Requirement private Logger logger = NullLogger.INSTANCE; From ff370850cdf51c5bcdee27d86852df6affefe9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 19 Jan 2013 13:36:20 +0100 Subject: [PATCH 081/102] refactoring: extracted MavenSnapshotMetadata from (Local+Remote)SnapshotMetadata --- .../internal/LocalSnapshotMetadata.java | 66 ++---------- .../internal/MavenSnapshotMetadata.java | 100 ++++++++++++++++++ .../internal/RemoteSnapshotMetadata.java | 72 +------------ .../repository/internal/VersionsMetadata.java | 13 +-- 4 files changed, 118 insertions(+), 133 deletions(-) create mode 100644 maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java index a084977abe..4cea6c1b3b 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java @@ -21,7 +21,6 @@ package org.apache.maven.repository.internal; import java.io.File; import java.util.ArrayList; -import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; @@ -35,66 +34,38 @@ import org.sonatype.aether.artifact.Artifact; * @author Benjamin Bentmann */ final class LocalSnapshotMetadata - extends MavenMetadata + extends MavenSnapshotMetadata { - private final Collection artifacts = new ArrayList(); - - private final boolean legacyFormat; - public LocalSnapshotMetadata( Artifact artifact, boolean legacyFormat ) { - super( createMetadata( artifact, legacyFormat ), null ); - this.legacyFormat = legacyFormat; + super( createLocalMetadata( artifact, legacyFormat ), null, legacyFormat ); } public LocalSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat ) { - super( metadata, file ); - this.legacyFormat = legacyFormat; + super( metadata, file, legacyFormat ); } - private static Metadata createMetadata( Artifact artifact, boolean legacyFormat ) + private static Metadata createLocalMetadata( Artifact artifact, boolean legacyFormat ) { + Metadata metadata = createRepositoryMetadata( artifact, legacyFormat ); + Snapshot snapshot = new Snapshot(); snapshot.setLocalCopy( true ); Versioning versioning = new Versioning(); versioning.setSnapshot( snapshot ); - Metadata metadata = new Metadata(); metadata.setVersioning( versioning ); - metadata.setGroupId( artifact.getGroupId() ); - metadata.setArtifactId( artifact.getArtifactId() ); - metadata.setVersion( artifact.getBaseVersion() ); - - if ( !legacyFormat ) - { - metadata.setModelVersion( "1.1.0" ); - } return metadata; } - public void bind( Artifact artifact ) - { - artifacts.add( artifact ); - } - public MavenMetadata setFile( File file ) { return new LocalSnapshotMetadata( metadata, file, legacyFormat ); } - public Object getKey() - { - return getGroupId() + ':' + getArtifactId() + ':' + getVersion(); - } - - public static Object getKey( Artifact artifact ) - { - return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion(); - } - @Override protected void merge( Metadata recessive ) { @@ -135,29 +106,4 @@ final class LocalSnapshotMetadata artifacts.clear(); } - private String getKey( String classifier, String extension ) - { - return classifier + ':' + extension; - } - - public String getGroupId() - { - return metadata.getGroupId(); - } - - public String getArtifactId() - { - return metadata.getArtifactId(); - } - - public String getVersion() - { - return metadata.getVersion(); - } - - public Nature getNature() - { - return Nature.SNAPSHOT; - } - } diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java new file mode 100644 index 0000000000..0f88cdc1d4 --- /dev/null +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenSnapshotMetadata.java @@ -0,0 +1,100 @@ +package org.apache.maven.repository.internal; + +/* + * 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 java.util.ArrayList; +import java.util.Collection; + +import org.apache.maven.artifact.repository.metadata.Metadata; +import org.sonatype.aether.artifact.Artifact; + +/** + * @author Hervé Boutemy + */ +abstract class MavenSnapshotMetadata + extends MavenMetadata +{ + static final String SNAPSHOT = "SNAPSHOT"; + + protected final Collection artifacts = new ArrayList(); + + protected final boolean legacyFormat; + + protected MavenSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat ) + { + super( metadata, file ); + this.legacyFormat = legacyFormat; + } + + protected static Metadata createRepositoryMetadata( Artifact artifact, boolean legacyFormat ) + { + Metadata metadata = new Metadata(); + if ( !legacyFormat ) + { + metadata.setModelVersion( "1.1.0" ); + } + metadata.setGroupId( artifact.getGroupId() ); + metadata.setArtifactId( artifact.getArtifactId() ); + metadata.setVersion( artifact.getBaseVersion() ); + + return metadata; + } + + public void bind( Artifact artifact ) + { + artifacts.add( artifact ); + } + + public Object getKey() + { + return getGroupId() + ':' + getArtifactId() + ':' + getVersion(); + } + + public static Object getKey( Artifact artifact ) + { + return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion(); + } + + protected String getKey( String classifier, String extension ) + { + return classifier + ':' + extension; + } + + public String getGroupId() + { + return metadata.getGroupId(); + } + + public String getArtifactId() + { + return metadata.getArtifactId(); + } + + public String getVersion() + { + return metadata.getVersion(); + } + + public Nature getNature() + { + return Nature.SNAPSHOT; + } +} diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java index 4ce43938ac..246c786e0b 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java @@ -23,7 +23,6 @@ import java.io.File; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Collection; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; @@ -39,46 +38,19 @@ import org.sonatype.aether.artifact.Artifact; * @author Benjamin Bentmann */ final class RemoteSnapshotMetadata - extends MavenMetadata + extends MavenSnapshotMetadata { - private static final String SNAPSHOT = "SNAPSHOT"; - - private final Collection artifacts = new ArrayList(); - private final Map versions = new LinkedHashMap(); - private final boolean legacyFormat; - public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat ) { - super( createMetadata( artifact, legacyFormat ), null ); - this.legacyFormat = legacyFormat; + super( createRepositoryMetadata( artifact, legacyFormat ), null, legacyFormat ); } private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat ) { - super( metadata, file ); - this.legacyFormat = legacyFormat; - } - - private static Metadata createMetadata( Artifact artifact, boolean legacyFormat ) - { - Metadata metadata = new Metadata(); - if ( !legacyFormat ) - { - metadata.setModelVersion( "1.1.0" ); - } - metadata.setGroupId( artifact.getGroupId() ); - metadata.setArtifactId( artifact.getArtifactId() ); - metadata.setVersion( artifact.getBaseVersion() ); - - return metadata; - } - - public void bind( Artifact artifact ) - { - artifacts.add( artifact ); + super( metadata, file, legacyFormat ); } public MavenMetadata setFile( File file ) @@ -86,16 +58,6 @@ final class RemoteSnapshotMetadata return new RemoteSnapshotMetadata( metadata, file, legacyFormat ); } - public Object getKey() - { - return getGroupId() + ':' + getArtifactId() + ':' + getVersion(); - } - - public static Object getKey( Artifact artifact ) - { - return artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion(); - } - public String getExpandedVersion( Artifact artifact ) { String key = getKey( artifact.getClassifier(), artifact.getExtension() ); @@ -136,7 +98,7 @@ final class RemoteSnapshotMetadata if ( version.endsWith( SNAPSHOT ) ) { - String qualifier = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber(); + String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier; } @@ -145,6 +107,7 @@ final class RemoteSnapshotMetadata sv.setExtension( artifact.getExtension() ); sv.setVersion( version ); sv.setUpdated( lastUpdated ); + versions.put( getKey( sv.getClassifier(), sv.getExtension() ), sv ); } @@ -169,11 +132,6 @@ final class RemoteSnapshotMetadata } } - private String getKey( String classifier, String extension ) - { - return classifier + ':' + extension; - } - private static int getBuildNumber( Metadata metadata ) { int number = 0; @@ -191,24 +149,4 @@ final class RemoteSnapshotMetadata return number; } - public String getGroupId() - { - return metadata.getGroupId(); - } - - public String getArtifactId() - { - return metadata.getArtifactId(); - } - - public String getVersion() - { - return metadata.getVersion(); - } - - public Nature getNature() - { - return Nature.SNAPSHOT; - } - } diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java index 139e5f8c9c..2fefe02e1d 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java @@ -40,18 +40,22 @@ final class VersionsMetadata public VersionsMetadata( Artifact artifact ) { - super( createMetadata( artifact ), null ); + super( createRepositoryMetadata( artifact ), null ); this.artifact = artifact; } public VersionsMetadata( Artifact artifact, File file ) { - super( createMetadata( artifact ), file ); + super( createRepositoryMetadata( artifact ), file ); this.artifact = artifact; } - private static Metadata createMetadata( Artifact artifact ) + private static Metadata createRepositoryMetadata( Artifact artifact ) { + Metadata metadata = new Metadata(); + metadata.setGroupId( artifact.getGroupId() ); + metadata.setArtifactId( artifact.getArtifactId() ); + Versioning versioning = new Versioning(); versioning.addVersion( artifact.getBaseVersion() ); if ( !artifact.isSnapshot() ) @@ -63,10 +67,7 @@ final class VersionsMetadata versioning.setLatest( artifact.getBaseVersion() ); } - Metadata metadata = new Metadata(); metadata.setVersioning( versioning ); - metadata.setGroupId( artifact.getGroupId() ); - metadata.setArtifactId( artifact.getArtifactId() ); return metadata; } From 2f97f96fb15ed41259eac984a256a1e130936832 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 5 Jan 2013 00:21:31 +0100 Subject: [PATCH 082/102] [MNG-5418] Can't activate a profile by checking for the presence of a file in ${myProperty}. --- .../model/building/DefaultModelBuilder.java | 2 + .../DefaultProfileActivationContext.java | 61 +++++++++++++++---- .../profile/ProfileActivationContext.java | 7 +++ .../activation/FileProfileActivator.java | 2 + 4 files changed, 61 insertions(+), 11 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index 90a20eb0ec..25d9eab957 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -278,6 +278,8 @@ public class DefaultModelBuilder modelNormalizer.mergeDuplicates( tmpModel, request, problems ); + profileActivationContext.setProjectProperties( tmpModel.getProperties() ); + List activePomProfiles = profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems ); currentData.setActiveProfiles( activePomProfiles ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java index 7258b8ba2f..5bd1c58383 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java @@ -21,13 +21,15 @@ package org.apache.maven.model.profile; import java.io.File; import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; /** * Describes the environmental context used to determine the activation status of profiles. - * + * * @author Benjamin Bentmann */ public class DefaultProfileActivationContext @@ -42,6 +44,8 @@ public class DefaultProfileActivationContext private Map userProperties = Collections.emptyMap(); + private Map projectProperties = Collections.emptyMap(); + private File projectDirectory; public List getActiveProfileIds() @@ -51,7 +55,7 @@ public class DefaultProfileActivationContext /** * Sets the identifiers of those profiles that should be activated by explicit demand. - * + * * @param activeProfileIds The identifiers of those profiles to activate, may be {@code null}. * @return This context, never {@code null}. */ @@ -76,7 +80,7 @@ public class DefaultProfileActivationContext /** * Sets the identifiers of those profiles that should be deactivated by explicit demand. - * + * * @param inactiveProfileIds The identifiers of those profiles to deactivate, may be {@code null}. * @return This context, never {@code null}. */ @@ -102,11 +106,11 @@ public class DefaultProfileActivationContext /** * Sets the system properties to use for interpolation and profile activation. The system properties are collected * from the runtime environment like {@link System#getProperties()} and environment variables. - * + * * @param systemProperties The system properties, may be {@code null}. * @return This context, never {@code null}. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public DefaultProfileActivationContext setSystemProperties( Properties systemProperties ) { if ( systemProperties != null ) @@ -124,7 +128,7 @@ public class DefaultProfileActivationContext /** * Sets the system properties to use for interpolation and profile activation. The system properties are collected * from the runtime environment like {@link System#getProperties()} and environment variables. - * + * * @param systemProperties The system properties, may be {@code null}. * @return This context, never {@code null}. */ @@ -151,11 +155,11 @@ public class DefaultProfileActivationContext * Sets the user properties to use for interpolation and profile activation. The user properties have been * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command * line. - * + * * @param userProperties The user properties, may be {@code null}. * @return This context, never {@code null}. */ - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") public DefaultProfileActivationContext setUserProperties( Properties userProperties ) { if ( userProperties != null ) @@ -174,7 +178,7 @@ public class DefaultProfileActivationContext * Sets the user properties to use for interpolation and profile activation. The user properties have been * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command * line. - * + * * @param userProperties The user properties, may be {@code null}. * @return This context, never {@code null}. */ @@ -199,9 +203,9 @@ public class DefaultProfileActivationContext /** * Sets the base directory of the current project. - * + * * @param projectDirectory The base directory of the current project, may be {@code null} if profile activation - * happens in the context of metadata retrieval rather than project building. + * happens in the context of metadata retrieval rather than project building. * @return This context, never {@code null}. */ public DefaultProfileActivationContext setProjectDirectory( File projectDirectory ) @@ -211,4 +215,39 @@ public class DefaultProfileActivationContext return this; } + public Map getProjectProperties() + { + return projectProperties; + } + + public DefaultProfileActivationContext setProjectProperties( Properties projectProperties ) + { + if ( projectProperties != null ) + { + + this.projectProperties = Collections.unmodifiableMap( toMap( projectProperties ) ); + } + else + { + this.projectProperties = Collections.emptyMap(); + } + + return this; + } + + private Map toMap( Properties properties ) + { + if ( properties == null ) + { + return Collections.emptyMap(); + } + Map map = new HashMap(); + Enumeration keys = properties.keys(); + while ( keys.hasMoreElements() ) + { + String key = (String) keys.nextElement(); + map.put( key, properties.getProperty( key ) ); + } + return map; + } } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java index 63540f23e7..fb9ea0cd89 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java @@ -69,4 +69,11 @@ public interface ProfileActivationContext */ File getProjectDirectory(); + /** + * Gets current calculated project properties + * + * @return The project properties, never {@code null}. + */ + Map getProjectProperties(); + } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java index aa35bcc120..b4ecf26177 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java @@ -118,6 +118,8 @@ public class FileProfileActivator return false; } + interpolator.addValueSource( new MapBasedValueSource( context.getProjectProperties() ) ); + interpolator.addValueSource( new MapBasedValueSource( context.getUserProperties() ) ); interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) ); From 176a85f43c6a69b042024f2daebff25376930ce2 Mon Sep 17 00:00:00 2001 From: Kristian Rosenvold Date: Tue, 29 Jan 2013 16:26:35 +0100 Subject: [PATCH 083/102] Fixed line feeds, added .gitattributes --- .gitattributes | 10 +- .../internal/AbstractRepositoryTestCase.java | 152 +++++++------- .../internal/DefaultVersionResolverTest.java | 192 +++++++++--------- .../07.20.3-SNAPSHOT/maven-metadata.xml | 96 ++++----- maven-core/src/site/apt/artifact-handlers.apt | 82 ++++---- .../artifact/handler/ArtifactHandlerTest.java | 178 ++++++++-------- .../DefaultExceptionHandlerTest.java | 120 +++++------ pom.xml | 2 +- src/site/site.xml | 146 ++++++------- 9 files changed, 492 insertions(+), 486 deletions(-) diff --git a/.gitattributes b/.gitattributes index 225f8f119c..3bb3b5ea8a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,8 @@ -*.jar -text -crlf -*.graffle -text -crlf +# Auto detect text files and perform LF normalization +* text=auto + +*.java text diff=java +*.html text diff=html +*.css text +*.js text +*.sql text diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java index 2ad80f8147..3b2f379fba 100644 --- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java +++ b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/AbstractRepositoryTestCase.java @@ -1,76 +1,76 @@ -package org.apache.maven.repository.internal; - -/* - * 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.net.MalformedURLException; - -import org.apache.maven.repository.internal.util.ConsoleRepositoryListener; -import org.apache.maven.repository.internal.util.ConsoleTransferListener; -import org.codehaus.plexus.PlexusTestCase; -import org.sonatype.aether.RepositorySystem; -import org.sonatype.aether.RepositorySystemSession; -import org.sonatype.aether.repository.LocalRepository; -import org.sonatype.aether.repository.RemoteRepository; - -public abstract class AbstractRepositoryTestCase - extends PlexusTestCase -{ - protected RepositorySystem system; - - protected RepositorySystemSession session; - - @Override - protected void setUp() - throws Exception - { - super.setUp(); - system = lookup( RepositorySystem.class ); - session = newMavenRepositorySystemSession( system ); - } - - @Override - protected void tearDown() - throws Exception - { - session = null; - system = null; - super.tearDown(); - } - - public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system ) - { - MavenRepositorySystemSession session = new MavenRepositorySystemSession( true ); - - LocalRepository localRepo = new LocalRepository( "target/local-repo" ); - session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) ); - - session.setTransferListener( new ConsoleTransferListener() ); - session.setRepositoryListener( new ConsoleRepositoryListener() ); - - return session; - } - - public static RemoteRepository newTestRepository() - throws MalformedURLException - { - return new RemoteRepository( "repo", "default", - getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() ); - } -} +package org.apache.maven.repository.internal; + +/* + * 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.net.MalformedURLException; + +import org.apache.maven.repository.internal.util.ConsoleRepositoryListener; +import org.apache.maven.repository.internal.util.ConsoleTransferListener; +import org.codehaus.plexus.PlexusTestCase; +import org.sonatype.aether.RepositorySystem; +import org.sonatype.aether.RepositorySystemSession; +import org.sonatype.aether.repository.LocalRepository; +import org.sonatype.aether.repository.RemoteRepository; + +public abstract class AbstractRepositoryTestCase + extends PlexusTestCase +{ + protected RepositorySystem system; + + protected RepositorySystemSession session; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + system = lookup( RepositorySystem.class ); + session = newMavenRepositorySystemSession( system ); + } + + @Override + protected void tearDown() + throws Exception + { + session = null; + system = null; + super.tearDown(); + } + + public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system ) + { + MavenRepositorySystemSession session = new MavenRepositorySystemSession( true ); + + LocalRepository localRepo = new LocalRepository( "target/local-repo" ); + session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) ); + + session.setTransferListener( new ConsoleTransferListener() ); + session.setRepositoryListener( new ConsoleRepositoryListener() ); + + return session; + } + + public static RemoteRepository newTestRepository() + throws MalformedURLException + { + return new RemoteRepository( "repo", "default", + getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() ); + } +} diff --git a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java index 39eaaf6473..1feaef808b 100644 --- a/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java +++ b/maven-aether-provider/src/test/java/org/apache/maven/repository/internal/DefaultVersionResolverTest.java @@ -1,96 +1,96 @@ -package org.apache.maven.repository.internal; - -/* - * 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.sonatype.aether.artifact.Artifact; -import org.sonatype.aether.impl.VersionResolver; -import org.sonatype.aether.resolution.VersionRequest; -import org.sonatype.aether.resolution.VersionResult; -import org.sonatype.aether.util.artifact.DefaultArtifact; - -public class DefaultVersionResolverTest - extends AbstractRepositoryTestCase -{ - private DefaultVersionResolver versionResolver; - - @Override - protected void setUp() - throws Exception - { - super.setUp(); - // be sure we're testing the right class, i.e. DefaultVersionResolver.class - versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" ); - } - - @Override - protected void tearDown() - throws Exception - { - versionResolver = null; - super.tearDown(); - } - - public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts() - throws Exception - { - VersionRequest requestB = new VersionRequest(); - requestB.addRepository( newTestRepository() ); - Artifact artifactB = - new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" ); - requestB.setArtifact( artifactB ); - - VersionResult resultB = versionResolver.resolveVersion( session, requestB ); - assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() ); - - VersionRequest requestA = new VersionRequest(); - requestA.addRepository( newTestRepository() ); - - Artifact artifactA = - new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" ); - requestA.setArtifact( artifactA ); - - VersionResult resultA = versionResolver.resolveVersion( session, requestA ); - assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() ); - } - - public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts() - throws Exception - { - VersionRequest requestA = new VersionRequest(); - requestA.addRepository( newTestRepository() ); - String versionA = "07.20.3-20120809.112124-88"; - Artifact artifactA = - new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA ); - requestA.setArtifact( artifactA ); - - VersionResult resultA = versionResolver.resolveVersion( session, requestA ); - assertEquals( versionA, resultA.getVersion() ); - - VersionRequest requestB = new VersionRequest(); - requestB.addRepository( newTestRepository() ); - String versionB = "07.20.3-20120809.112920-97"; - Artifact artifactB = - new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB ); - requestB.setArtifact( artifactB ); - - VersionResult resultB = versionResolver.resolveVersion( session, requestB ); - assertEquals( versionB, resultB.getVersion() ); - } -} +package org.apache.maven.repository.internal; + +/* + * 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.sonatype.aether.artifact.Artifact; +import org.sonatype.aether.impl.VersionResolver; +import org.sonatype.aether.resolution.VersionRequest; +import org.sonatype.aether.resolution.VersionResult; +import org.sonatype.aether.util.artifact.DefaultArtifact; + +public class DefaultVersionResolverTest + extends AbstractRepositoryTestCase +{ + private DefaultVersionResolver versionResolver; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + // be sure we're testing the right class, i.e. DefaultVersionResolver.class + versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" ); + } + + @Override + protected void tearDown() + throws Exception + { + versionResolver = null; + super.tearDown(); + } + + public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts() + throws Exception + { + VersionRequest requestB = new VersionRequest(); + requestB.addRepository( newTestRepository() ); + Artifact artifactB = + new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" ); + requestB.setArtifact( artifactB ); + + VersionResult resultB = versionResolver.resolveVersion( session, requestB ); + assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() ); + + VersionRequest requestA = new VersionRequest(); + requestA.addRepository( newTestRepository() ); + + Artifact artifactA = + new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" ); + requestA.setArtifact( artifactA ); + + VersionResult resultA = versionResolver.resolveVersion( session, requestA ); + assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() ); + } + + public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts() + throws Exception + { + VersionRequest requestA = new VersionRequest(); + requestA.addRepository( newTestRepository() ); + String versionA = "07.20.3-20120809.112124-88"; + Artifact artifactA = + new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA ); + requestA.setArtifact( artifactA ); + + VersionResult resultA = versionResolver.resolveVersion( session, requestA ); + assertEquals( versionA, resultA.getVersion() ); + + VersionRequest requestB = new VersionRequest(); + requestB.addRepository( newTestRepository() ); + String versionB = "07.20.3-20120809.112920-97"; + Artifact artifactB = + new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB ); + requestB.setArtifact( artifactB ); + + VersionResult resultB = versionResolver.resolveVersion( session, requestB ); + assertEquals( versionB, resultB.getVersion() ); + } +} diff --git a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml b/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml index db26c6eb30..9f0a7fedd6 100644 --- a/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml +++ b/maven-aether-provider/src/test/resources/repo/org/apache/maven/its/dep-mng5324/07.20.3-SNAPSHOT/maven-metadata.xml @@ -1,49 +1,49 @@ - - - - - - org.apache.maven.its - dep-mng5324 - 07.20.3-SNAPSHOT - - - 20120809.112920 - 97 - - 20120809112920 - - - classifierA - jar - 07.20.3-20120809.112124-88 - 20120809112124 - - - classifierB - jar - 07.20.3-20120809.112920-97 - 20120809112920 - - - + + + + + + org.apache.maven.its + dep-mng5324 + 07.20.3-SNAPSHOT + + + 20120809.112920 + 97 + + 20120809112920 + + + classifierA + jar + 07.20.3-20120809.112124-88 + 20120809112124 + + + classifierB + jar + 07.20.3-20120809.112920-97 + 20120809112920 + + + \ No newline at end of file diff --git a/maven-core/src/site/apt/artifact-handlers.apt b/maven-core/src/site/apt/artifact-handlers.apt index 7f211a6ac7..3eea01785f 100644 --- a/maven-core/src/site/apt/artifact-handlers.apt +++ b/maven-core/src/site/apt/artifact-handlers.apt @@ -1,41 +1,41 @@ - --- - Default Artifact Handlers Reference - --- - Hervé Boutemy - --- - 2012-08-13 - --- - -Default Artifact Handlers Reference - - Some artifact handlers are defined by default: - -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -|| type || extension || packaging || classifier || language || added to classpath || includesDependencies || -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | none | | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <= type> | | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <= type> | | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | | <<>> | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | | <<>> | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | | <<>> | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | | <<>> | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <= type> | <= type> | | java | | <<>> | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <= type> | <<>> | java | | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <= type> | <<>> | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <<>> | <<>> | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ -| <<>> | <<>> | <<>> | <<>> | java | <<>> | | -*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ + --- + Default Artifact Handlers Reference + --- + Hervé Boutemy + --- + 2012-08-13 + --- + +Default Artifact Handlers Reference + + Some artifact handlers are defined by default: + +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +|| type || extension || packaging || classifier || language || added to classpath || includesDependencies || +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | none | | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <= type> | | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <= type> | | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | | <<>> | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | | <<>> | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | | <<>> | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | | <<>> | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <= type> | <= type> | | java | | <<>> | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <= type> | <<>> | java | | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <= type> | <<>> | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <<>> | <<>> | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ +| <<>> | <<>> | <<>> | <<>> | java | <<>> | | +*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+ diff --git a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java index 2edbcf4410..ac02e106d3 100644 --- a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java +++ b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java @@ -1,89 +1,89 @@ -package org.apache.maven.artifact.handler; - -/* - * 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 java.util.List; - -import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.util.FileUtils; - -public class ArtifactHandlerTest - extends PlexusTestCase -{ - public void testAptConsistency() - throws Exception - { - File apt = getTestFile( "src/site/apt/artifact-handlers.apt" ); - - @SuppressWarnings( "unchecked" ) - List lines = FileUtils.loadFile( apt ); - - for ( String line : lines ) - { - if ( line.startsWith( "||" ) ) - { - String[] cols = line.split( "\\|\\|" ); - String[] expected = - new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath", - "includesDependencies", "" }; - - int i = 0; - for ( String col : cols ) - { - assertEquals( "Wrong column header", expected[i++], col.trim() ); - } - } - else if ( line.startsWith( "|" ) ) - { - String[] cols = line.split( "\\|" ); - - String type = trimApt( cols[1] ); - String extension = trimApt( cols[2], type ); - String packaging = trimApt( cols[3], type ); - String classifier = trimApt( cols[4] ); - String language = trimApt( cols[5] ); - String addedToClasspath = trimApt( cols[6] ); - String includesDependencies = trimApt( cols[7] ); - - ArtifactHandler handler = lookup( ArtifactHandler.class, type ); - assertEquals( type + " extension", handler.getExtension(), extension ); - assertEquals( type + " packaging", handler.getPackaging(), packaging ); - assertEquals( type + " classifier", handler.getClassifier(), classifier ); - assertEquals( type + " language", handler.getLanguage(), language ); - assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath ); - assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies ); - } - } - } - - private String trimApt( String content, String type ) - { - String value = trimApt( content ); - return "= type".equals( value ) ? type : value; - } - - private String trimApt( String content ) - { - content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim(); - - return ( content.length() == 0 ) ? null : content; - } -} +package org.apache.maven.artifact.handler; + +/* + * 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 java.util.List; + +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +public class ArtifactHandlerTest + extends PlexusTestCase +{ + public void testAptConsistency() + throws Exception + { + File apt = getTestFile( "src/site/apt/artifact-handlers.apt" ); + + @SuppressWarnings( "unchecked" ) + List lines = FileUtils.loadFile( apt ); + + for ( String line : lines ) + { + if ( line.startsWith( "||" ) ) + { + String[] cols = line.split( "\\|\\|" ); + String[] expected = + new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath", + "includesDependencies", "" }; + + int i = 0; + for ( String col : cols ) + { + assertEquals( "Wrong column header", expected[i++], col.trim() ); + } + } + else if ( line.startsWith( "|" ) ) + { + String[] cols = line.split( "\\|" ); + + String type = trimApt( cols[1] ); + String extension = trimApt( cols[2], type ); + String packaging = trimApt( cols[3], type ); + String classifier = trimApt( cols[4] ); + String language = trimApt( cols[5] ); + String addedToClasspath = trimApt( cols[6] ); + String includesDependencies = trimApt( cols[7] ); + + ArtifactHandler handler = lookup( ArtifactHandler.class, type ); + assertEquals( type + " extension", handler.getExtension(), extension ); + assertEquals( type + " packaging", handler.getPackaging(), packaging ); + assertEquals( type + " classifier", handler.getClassifier(), classifier ); + assertEquals( type + " language", handler.getLanguage(), language ); + assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath ); + assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies ); + } + } + } + + private String trimApt( String content, String type ) + { + String value = trimApt( content ); + return "= type".equals( value ) ? type : value; + } + + private String trimApt( String content ) + { + content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim(); + + return ( content.length() == 0 ) ? null : content; + } +} diff --git a/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java b/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java index aa81f4642e..9727bdf8a2 100644 --- a/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java +++ b/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java @@ -1,60 +1,60 @@ -package org.apache.maven.exception; - -/* - * 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.IOException; -import java.net.ConnectException; - -import org.apache.maven.plugin.MojoExecutionException; - -import junit.framework.TestCase; - -/** - * @author Barrie Treloar - */ -public class DefaultExceptionHandlerTest - extends TestCase -{ - /** - * Running Maven under JDK7 may cause connection issues because IPv6 is used by default. - *

- * e.g running mvn site:run will cause Jetty to fail. - *

- *

- * The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in - * http://cwiki.apache.org/confluence/display/MAVEN/ConnectException - *

- */ - public void testJdk7ipv6() - { - ConnectException connEx = new ConnectException( "Connection refused: connect" ); - IOException ioEx = new IOException( "Unable to establish loopback connection" ); - ioEx.initCause( connEx ); - MojoExecutionException mojoEx = - new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx ); - - ExceptionHandler exceptionHandler = new DefaultExceptionHandler(); - ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx ); - - String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException"; - assertEquals( expectedReference, exceptionSummary.getReference() ); - - } -} +package org.apache.maven.exception; + +/* + * 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.IOException; +import java.net.ConnectException; + +import org.apache.maven.plugin.MojoExecutionException; + +import junit.framework.TestCase; + +/** + * @author Barrie Treloar + */ +public class DefaultExceptionHandlerTest + extends TestCase +{ + /** + * Running Maven under JDK7 may cause connection issues because IPv6 is used by default. + *

+ * e.g running mvn site:run will cause Jetty to fail. + *

+ *

+ * The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in + * http://cwiki.apache.org/confluence/display/MAVEN/ConnectException + *

+ */ + public void testJdk7ipv6() + { + ConnectException connEx = new ConnectException( "Connection refused: connect" ); + IOException ioEx = new IOException( "Unable to establish loopback connection" ); + ioEx.initCause( connEx ); + MojoExecutionException mojoEx = + new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx ); + + ExceptionHandler exceptionHandler = new DefaultExceptionHandler(); + ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx ); + + String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException"; + assertEquals( expectedReference, exceptionSummary.getReference() ); + + } +} diff --git a/pom.xml b/pom.xml index 68dec80e94..1beec5161e 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 1.16 3.0.10 2.3.0 - 2.3 + 2.4-SNAPSHOT 1.3 1.7 1.6 diff --git a/src/site/site.xml b/src/site/site.xml index fb96718f68..6954e93cde 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -1,74 +1,74 @@ - - - - - - - - ${project.name} - http://maven.apache.org/images/apache-maven-project.png - http://maven.apache.org/ - - - http://maven.apache.org/images/maventxt_logo_200.gif - - - - org.apache.maven.skins - maven-fluido-skin - 1.2.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + ${project.name} + http://maven.apache.org/images/apache-maven-project.png + http://maven.apache.org/ + + + http://maven.apache.org/images/maventxt_logo_200.gif + + + + org.apache.maven.skins + maven-fluido-skin + 1.2.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 6c3ec90f2c2abdb4caa45db3ab43f00c84e2e353 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Thu, 31 Jan 2013 23:02:19 +0100 Subject: [PATCH 084/102] prevent possible NPE --- .../maven/repository/internal/DefaultVersionResolver.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index 759d90ec82..0b56970034 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -313,6 +313,12 @@ public class DefaultVersionResolver { Versioning versioning = null; + + if (metadata == null) + { + return new Versioning(); + } + SyncContext syncContext = syncContextFactory.newInstance( session, true ); try From 27f8b0f81af3bf49cba251e2e857a7e67562132f Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 1 Feb 2013 00:35:46 +0100 Subject: [PATCH 085/102] [MNG-5185] [MNG-5181] add cli flag to be able to remove use of EnhancedLocalRepositoryManager. --- .../java/org/apache/maven/DefaultMaven.java | 23 ++++++++++++++++++- .../DefaultMavenExecutionRequest.java | 12 ++++++++++ .../execution/MavenExecutionRequest.java | 10 ++++++++ .../java/org/apache/maven/cli/CLIManager.java | 3 +++ .../java/org/apache/maven/cli/MavenCli.java | 10 ++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index e80185bbda..a6e11e8c3e 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -85,8 +85,10 @@ import org.sonatype.aether.RepositorySystem; import org.sonatype.aether.RepositorySystemSession; import org.sonatype.aether.repository.Authentication; import org.sonatype.aether.repository.LocalRepository; +import org.sonatype.aether.repository.NoLocalRepositoryManagerException; import org.sonatype.aether.repository.RepositoryPolicy; import org.sonatype.aether.repository.WorkspaceReader; +import org.sonatype.aether.spi.localrepo.LocalRepositoryManagerFactory; import org.sonatype.aether.util.DefaultRepositorySystemSession; import org.sonatype.aether.util.repository.ChainedWorkspaceReader; import org.sonatype.aether.util.repository.DefaultAuthenticationSelector; @@ -128,6 +130,9 @@ public class DefaultMaven @Requirement private RepositorySystem repoSystem; + @Requirement (optional = true, hint = "simple") + private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory; + @Requirement private SettingsDecrypter settingsDecrypter; @@ -352,7 +357,23 @@ public class DefaultMaven session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) ); LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() ); - session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); + + if (request.isUseSimpleLocalRepostoryManager()) + { + try + { + session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( localRepo ) ); + } + catch ( NoLocalRepositoryManagerException e ) + { + + logger.warn( "fail to configure simple local repository manager back to default" ); + session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); + } + } + else { + session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); + } if ( request.getWorkspaceReader() != null ) { diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 78436be6b5..313984622e 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -143,6 +143,8 @@ public class DefaultMavenExecutionRequest */ private boolean noSnapshotUpdates; + private boolean useSimpleLocalRepostoryManager = false; + public DefaultMavenExecutionRequest() { } @@ -1076,4 +1078,14 @@ public class DefaultMavenExecutionRequest return this; } + public boolean isUseSimpleLocalRepostoryManager() + { + return this.useSimpleLocalRepostoryManager; + } + + public MavenExecutionRequest setUseSimpleLocalRepostoryManager( boolean useSimpleLocalRepostoryManager ) + { + this.useSimpleLocalRepostoryManager = useSimpleLocalRepostoryManager; + return this; + } } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index ef88a1769f..5ab11b3cae 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -283,4 +283,14 @@ public interface MavenExecutionRequest ProjectBuildingRequest getProjectBuildingRequest(); + /** + * @since 3.1 + */ + boolean isUseSimpleLocalRepostoryManager(); + + /** + * @since 3.1 + */ + MavenExecutionRequest setUseSimpleLocalRepostoryManager(boolean useSimpleLocalRepostoryManager); + } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 0e7f2b622a..32c1bb2758 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -97,6 +97,8 @@ public class CLIManager public static final String THREADS = "T"; + public static final String SIMPLE_LOCAL_REPOSITORY_MANAGER ="slrm"; + protected Options options; @SuppressWarnings( "static-access" ) @@ -134,6 +136,7 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); + options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( "Use a simple local Repository Manager (no use of _maven.repositories)" ).create( SIMPLE_LOCAL_REPOSITORY_MANAGER ) ); // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 5a4710fd04..dd42ba6924 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -210,6 +210,7 @@ public class MavenCli settings( cliRequest ); populateRequest( cliRequest ); encryption( cliRequest ); + repository( cliRequest ); return execute( cliRequest ); } catch ( ExitException e ) @@ -538,6 +539,15 @@ public class MavenCli } } + private void repository( CliRequest cliRequest ) + throws Exception + { + if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) ) + { + cliRequest.request.setUseSimpleLocalRepostoryManager( true ); + } + } + private int execute( CliRequest cliRequest ) { eventSpyDispatcher.onEvent( cliRequest.request ); From 8ada7e763b9d2333c34d397ae64294cd0f5b0128 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 1 Feb 2013 00:41:44 +0100 Subject: [PATCH 086/102] [MNG-5185] [MNG-5181] can be activated using -Dmaven.simpleLocalRepoMan=true (for add in MAVEN_OPTS) --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 4 +++- .../src/main/java/org/apache/maven/cli/MavenCli.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 32c1bb2758..44eb7a36c7 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -136,7 +136,9 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); - options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( "Use a simple local Repository Manager (no use of _maven.repositories)" ).create( SIMPLE_LOCAL_REPOSITORY_MANAGER ) ); + options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( + "Use a simple local Repository Manager (no use of _maven.repositories) can be activated using -Dmaven.simpleLocalRepoMan=true" ).create( + SIMPLE_LOCAL_REPOSITORY_MANAGER ) ); // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index dd42ba6924..a6ce4976c8 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -542,7 +542,7 @@ public class MavenCli private void repository( CliRequest cliRequest ) throws Exception { - if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) ) + if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) || Boolean.getBoolean( "maven.simpleLocalRepoMan" ) ) { cliRequest.request.setUseSimpleLocalRepostoryManager( true ); } From 7196f82ff2bac5426481b44fd57e9c388fedb1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 09:40:06 +0100 Subject: [PATCH 087/102] improved javadoc --- .../maven/plugin/PluginParameterExpressionEvaluator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java index 6d8051a28e..5c703ce5bb 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java @@ -53,8 +53,8 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor; * mojo.* (since Maven 3) * plugin (since Maven 3){@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor() getPluginDescriptor()} * plugin.* - * system properties - * project properties + * * system properties + * * project properties * * Notice: reports was supported in Maven 2.x but was removed in Maven 3 * From 3ad5e54036957a416c78e2b903f37ac5c53f5ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 15:21:09 +0100 Subject: [PATCH 088/102] improved description --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1beec5161e..1fe6310382 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ pom Apache Maven - Maven is a project development management and + Maven is a software build management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from From ab9b42d3dbdc4ac37ad23f2f697918f28972718c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 15:28:13 +0100 Subject: [PATCH 089/102] publish site to fixed location /ref/3-latest to better use svnpubsub: release directory creation will be done with "svn cp 3-latest " --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1fe6310382..05cdf274cd 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ apache.website - scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/${project.version} + scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/3-latest From 853636d6aa6b52b3b2a850d3de54189669a5f888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 16:46:43 +0100 Subject: [PATCH 090/102] code formatting --- .../maven/repository/internal/DefaultVersionResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java index 0b56970034..cf34483480 100644 --- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java +++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java @@ -314,7 +314,7 @@ public class DefaultVersionResolver Versioning versioning = null; - if (metadata == null) + if ( metadata == null ) { return new Versioning(); } From 71dd7f3d2a4bf5886cec9849ae2dae70dda95962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 16:52:16 +0100 Subject: [PATCH 091/102] code formatting --- .../src/main/java/org/apache/maven/DefaultMaven.java | 9 +++++---- .../apache/maven/execution/MavenExecutionRequest.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index a6e11e8c3e..d85f1ac6a8 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -130,7 +130,7 @@ public class DefaultMaven @Requirement private RepositorySystem repoSystem; - @Requirement (optional = true, hint = "simple") + @Requirement( optional = true, hint = "simple" ) private LocalRepositoryManagerFactory simpleLocalRepositoryManagerFactory; @Requirement @@ -358,7 +358,7 @@ public class DefaultMaven LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() ); - if (request.isUseSimpleLocalRepostoryManager()) + if ( request.isUseSimpleLocalRepostoryManager() ) { try { @@ -367,11 +367,12 @@ public class DefaultMaven catch ( NoLocalRepositoryManagerException e ) { - logger.warn( "fail to configure simple local repository manager back to default" ); + logger.warn( "Failed to configure simple local repository manager: back to default" ); session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); } } - else { + else + { session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 5ab11b3cae..5bd839a296 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -291,6 +291,6 @@ public interface MavenExecutionRequest /** * @since 3.1 */ - MavenExecutionRequest setUseSimpleLocalRepostoryManager(boolean useSimpleLocalRepostoryManager); + MavenExecutionRequest setUseSimpleLocalRepostoryManager( boolean useSimpleLocalRepostoryManager ); } From 5d06bc6a25d40da49b9f477e3c2b408505dbae61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 16:59:20 +0100 Subject: [PATCH 092/102] fixed typo --- .../src/main/java/org/apache/maven/DefaultMaven.java | 2 +- .../maven/execution/DefaultMavenExecutionRequest.java | 10 +++++----- .../apache/maven/execution/MavenExecutionRequest.java | 4 ++-- .../src/main/java/org/apache/maven/cli/CLIManager.java | 4 ++-- .../src/main/java/org/apache/maven/cli/MavenCli.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index d85f1ac6a8..ac92afc3fe 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -358,7 +358,7 @@ public class DefaultMaven LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() ); - if ( request.isUseSimpleLocalRepostoryManager() ) + if ( request.isUseSimpleLocalRepositoryManager() ) { try { diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 313984622e..09ead1a82a 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -143,7 +143,7 @@ public class DefaultMavenExecutionRequest */ private boolean noSnapshotUpdates; - private boolean useSimpleLocalRepostoryManager = false; + private boolean useSimpleLocalRepositoryManager = false; public DefaultMavenExecutionRequest() { @@ -1078,14 +1078,14 @@ public class DefaultMavenExecutionRequest return this; } - public boolean isUseSimpleLocalRepostoryManager() + public boolean isUseSimpleLocalRepositoryManager() { - return this.useSimpleLocalRepostoryManager; + return this.useSimpleLocalRepositoryManager; } - public MavenExecutionRequest setUseSimpleLocalRepostoryManager( boolean useSimpleLocalRepostoryManager ) + public MavenExecutionRequest setUseSimpleLocalRepositoryManager( boolean useSimpleLocalRepositoryManager ) { - this.useSimpleLocalRepostoryManager = useSimpleLocalRepostoryManager; + this.useSimpleLocalRepositoryManager = useSimpleLocalRepositoryManager; return this; } } diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 5bd839a296..cb4b207bde 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -286,11 +286,11 @@ public interface MavenExecutionRequest /** * @since 3.1 */ - boolean isUseSimpleLocalRepostoryManager(); + boolean isUseSimpleLocalRepositoryManager(); /** * @since 3.1 */ - MavenExecutionRequest setUseSimpleLocalRepostoryManager( boolean useSimpleLocalRepostoryManager ); + MavenExecutionRequest setUseSimpleLocalRepositoryManager( boolean useSimpleLocalRepositoryManager ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 44eb7a36c7..4bcbda6c9c 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -137,10 +137,10 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( - "Use a simple local Repository Manager (no use of _maven.repositories) can be activated using -Dmaven.simpleLocalRepoMan=true" ).create( + "Use a simple Local Repository Manager, ie no use of _maven.repositories. Can be activated using -Dmaven.simpleLocalRepoMan=true" ).create( SIMPLE_LOCAL_REPOSITORY_MANAGER ) ); - // Adding this back in for compatibility with the verifier that hard codes this option. + // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "cpu" ) ); options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "up" ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index a6ce4976c8..9fad9e60bc 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -544,7 +544,7 @@ public class MavenCli { if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) || Boolean.getBoolean( "maven.simpleLocalRepoMan" ) ) { - cliRequest.request.setUseSimpleLocalRepostoryManager( true ); + cliRequest.request.setUseSimpleLocalRepositoryManager( true ); } } From aeee413bda75bcd5f2c3edf1c9e62837a4115fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 2 Feb 2013 18:08:18 +0100 Subject: [PATCH 093/102] updated maven-parent to latest release --- pom.xml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index 05cdf274cd..9365e43b1e 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ org.apache.maven maven-parent - 22 + 23 ../pom/maven/pom.xml @@ -62,7 +62,6 @@ apache-maven Maven Apache Maven - ${user.home}/maven-sites @@ -451,16 +450,6 @@ - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.6 - - - - apache-release @@ -485,11 +474,6 @@ reporting - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.6 - org.apache.maven.plugins maven-javadoc-plugin From 114c98f31054026b638d38438ef35669e0a7fb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 4 Feb 2013 01:27:53 +0100 Subject: [PATCH 094/102] [MNG-5181] added a warning when enhanced local repository manager is disabled: this should be avoided --- maven-core/src/main/java/org/apache/maven/DefaultMaven.java | 1 + 1 file changed, 1 insertion(+) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index ac92afc3fe..9dfa7c8120 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -360,6 +360,7 @@ public class DefaultMaven if ( request.isUseSimpleLocalRepositoryManager() ) { + logger.warn( "Disabling enhanced local repository manager: this is stronlgy discouraged to ensure build reproducibility." ); try { session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( localRepo ) ); From ca514cea447c10dd9b133eb28b15a188d45e7fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 6 Feb 2013 22:18:06 +0100 Subject: [PATCH 095/102] updated svnpubsub configuration to publish to /ref/3-LATEST (consistent with websites' r849425) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9365e43b1e..641730d226 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ apache.website - scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/3-latest + scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/3-LATEST @@ -419,7 +419,7 @@ maven-scm-publish-plugin 1.0-beta-2 - ${maven.site.cache}/ref/${project.version} + ${maven.site.cache}/ref/3-LATEST true From 02014d8b38a337fa03588e3993abb4ea3ce27b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 6 Feb 2013 22:19:56 +0100 Subject: [PATCH 096/102] updated ciManagement url --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 641730d226..c3ea2fba49 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ Jenkins - https://builds.apache.org/job/maven-3.0.x/ + https://builds.apache.org/job/maven-3.x/ From 297bbca90f3d9d8b23d69d2493476b0df81d1de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 7 Feb 2013 00:00:04 +0100 Subject: [PATCH 097/102] fixed svnpubsub configuration (since parent pom upgrade, staging result base directory has changed) --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index c3ea2fba49..0b842763cf 100644 --- a/pom.xml +++ b/pom.xml @@ -419,6 +419,7 @@ maven-scm-publish-plugin 1.0-beta-2 + ${project.build.directory}/staging/ref/3-LATEST ${maven.site.cache}/ref/3-LATEST true From ada6bd1e63087a881f2f4994a7a6c9324f806dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Thu, 7 Feb 2013 00:02:31 +0100 Subject: [PATCH 098/102] introduced maven.site.path property --- pom.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 0b842763cf..f67b00eff7 100644 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,7 @@ apache-maven Maven Apache Maven + ref/3-LATEST @@ -96,7 +97,7 @@ apache.website - scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/ref/3-LATEST + scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/${maven.site.path} @@ -419,8 +420,8 @@ maven-scm-publish-plugin 1.0-beta-2 - ${project.build.directory}/staging/ref/3-LATEST - ${maven.site.cache}/ref/3-LATEST + ${project.build.directory}/staging/${maven.site.path} + ${maven.site.cache}/${maven.site.path} true From 720bef7df7bb2c7f7e19930d66b00518b50a3ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 9 Feb 2013 15:43:00 +0100 Subject: [PATCH 099/102] [MNG-5181] renamed *simple* local repository *manager* to *legacy* local repository --- .../src/main/java/org/apache/maven/DefaultMaven.java | 6 +++--- .../maven/execution/DefaultMavenExecutionRequest.java | 4 ++-- .../org/apache/maven/execution/MavenExecutionRequest.java | 4 ++-- .../src/main/java/org/apache/maven/cli/CLIManager.java | 7 ++----- .../src/main/java/org/apache/maven/cli/MavenCli.java | 4 ++-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 9dfa7c8120..98dc5c1805 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -358,9 +358,9 @@ public class DefaultMaven LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() ); - if ( request.isUseSimpleLocalRepositoryManager() ) + if ( request.isUseLegacyLocalRepository() ) { - logger.warn( "Disabling enhanced local repository manager: this is stronlgy discouraged to ensure build reproducibility." ); + logger.warn( "Disabling enhanced local repository: using legacy is stronlgy discouraged to ensure build reproducibility." ); try { session.setLocalRepositoryManager( simpleLocalRepositoryManagerFactory.newInstance( localRepo ) ); @@ -368,7 +368,7 @@ public class DefaultMaven catch ( NoLocalRepositoryManagerException e ) { - logger.warn( "Failed to configure simple local repository manager: back to default" ); + logger.warn( "Failed to configure legacy local repository: back to default" ); session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( localRepo ) ); } } diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index 09ead1a82a..bea605947e 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -1078,12 +1078,12 @@ public class DefaultMavenExecutionRequest return this; } - public boolean isUseSimpleLocalRepositoryManager() + public boolean isUseLegacyLocalRepository() { return this.useSimpleLocalRepositoryManager; } - public MavenExecutionRequest setUseSimpleLocalRepositoryManager( boolean useSimpleLocalRepositoryManager ) + public MavenExecutionRequest setUseLegacyLocalRepository( boolean useSimpleLocalRepositoryManager ) { this.useSimpleLocalRepositoryManager = useSimpleLocalRepositoryManager; return this; diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index cb4b207bde..62b6662c3a 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -286,11 +286,11 @@ public interface MavenExecutionRequest /** * @since 3.1 */ - boolean isUseSimpleLocalRepositoryManager(); + boolean isUseLegacyLocalRepository(); /** * @since 3.1 */ - MavenExecutionRequest setUseSimpleLocalRepositoryManager( boolean useSimpleLocalRepositoryManager ); + MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepository ); } diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 4bcbda6c9c..e4c62e3702 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -97,7 +97,7 @@ public class CLIManager public static final String THREADS = "T"; - public static final String SIMPLE_LOCAL_REPOSITORY_MANAGER ="slrm"; + public static final String LEGACY_LOCAL_REPOSITORY ="llr"; protected Options options; @@ -135,10 +135,7 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); - - options.addOption( OptionBuilder.withLongOpt( "simple-local-repository-manager" ).withDescription( - "Use a simple Local Repository Manager, ie no use of _maven.repositories. Can be activated using -Dmaven.simpleLocalRepoMan=true" ).create( - SIMPLE_LOCAL_REPOSITORY_MANAGER ) ); + options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Laven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can be activated using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) ); // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 9fad9e60bc..0e71c8b718 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -542,9 +542,9 @@ public class MavenCli private void repository( CliRequest cliRequest ) throws Exception { - if ( cliRequest.commandLine.hasOption( CLIManager.SIMPLE_LOCAL_REPOSITORY_MANAGER ) || Boolean.getBoolean( "maven.simpleLocalRepoMan" ) ) + if ( cliRequest.commandLine.hasOption( CLIManager.LEGACY_LOCAL_REPOSITORY ) || Boolean.getBoolean( "maven.legacyLocalRepo" ) ) { - cliRequest.request.setUseSimpleLocalRepositoryManager( true ); + cliRequest.request.setUseLegacyLocalRepository( true ); } } From 40ecab772cfd5412d0b5464abec8a477bbdea8c3 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sun, 10 Feb 2013 21:13:15 +0100 Subject: [PATCH 100/102] use released wagon 2.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f67b00eff7..2ffd0e86ce 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 1.16 3.0.10 2.3.0 - 2.4-SNAPSHOT + 2.4 1.3 1.7 1.6 From 353f73bf22aae9a585e190978b5d81883a2c89e6 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Mon, 11 Feb 2013 11:19:55 +0100 Subject: [PATCH 101/102] Fix typo --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index e4c62e3702..7893101781 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -135,7 +135,7 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); - options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Laven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can be activated using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) ); + options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can be activated using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) ); // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); From b1b526ac9eaeb472346ced481940dbd729ac3d62 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Mon, 11 Feb 2013 16:13:45 +0100 Subject: [PATCH 102/102] Improve description --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 7893101781..d30a16dcae 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -135,7 +135,7 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) ); options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); - options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can be activated using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) ); + options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _maven.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) ); // Adding this back in for compatibility with the verifier that hard codes this option. options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );