Author: hboutemy
Date: Thu Sep 10 22:05:49 2009
New Revision: 813615
URL: http://svn.apache.org/viewvc?rev=813615&view=rev
Log:
fixed errors reported by Checkstyle
Modified:
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractCoreMavenComponentTestCase.java
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
Modified:
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
Thu Sep 10 22:05:49 2009
@@ -1,5 +1,24 @@
package org.apache.maven.cli;
+/*
+ * 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.io.InputStream;
import java.text.DateFormat;
@@ -15,9 +34,9 @@
/**
* Utility class used to report errors, statistics, application version info,
etc.
- *
+ *
* @author jdcasey
- *
+ *
*/
public final class CLIReportingUtils
{
@@ -60,8 +79,8 @@
System.out.println( "Default locale: " + Locale.getDefault() + ",
platform encoding: "
+ System.getProperty( "file.encoding", "<unknown
encoding>" ) );
- System.out.println( "OS name: \"" + Os.OS_NAME + "\" version: \"" +
Os.OS_VERSION +
- "\" arch: \"" + Os.OS_ARCH + "\" Family: \"" +
Os.OS_FAMILY + "\"" );
+ System.out.println( "OS name: \"" + Os.OS_NAME + "\" version: \"" +
Os.OS_VERSION
+ + "\" arch: \"" + Os.OS_ARCH + "\" Family: \"" +
Os.OS_FAMILY + "\"" );
}
private static String reduce( String s )
@@ -69,7 +88,7 @@
return ( s != null ? ( s.startsWith( "${" ) && s.endsWith( "}" ) ?
null : s ) : null );
}
-
+
private static void stats( Date start, MavenEmbedderLogger logger )
{
Date finish = new Date();
@@ -137,7 +156,7 @@
fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
return fmt.format( new Date( time ) );
}
-
+
static Properties getBuildProperties()
{
Properties properties = new Properties();
Modified:
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
Thu Sep 10 22:05:49 2009
@@ -68,8 +68,8 @@
boolean pluginUpdateOverride = false;
- if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES ) ||
- commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES2 ) )
+ if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES )
+ || commandLine.hasOption( CLIManager.FORCE_PLUGIN_UPDATES2 ) )
{
pluginUpdateOverride = true;
}
@@ -151,7 +151,7 @@
String [] profileOptionValues = commandLine.getOptionValues(
CLIManager.ACTIVATE_PROFILES );
if ( profileOptionValues != null )
{
- for ( int i=0; i < profileOptionValues.length; ++i )
+ for ( int i = 0; i < profileOptionValues.length; ++i )
{
StringTokenizer profileTokens = new StringTokenizer(
profileOptionValues[i] , "," );
@@ -244,22 +244,22 @@
.setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
.setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
.setUserToolchainsFile( userToolchainsFile );
-
+
File pom;
-
+
if ( alternatePomFile != null )
{
pom = new File( alternatePomFile );
}
else
{
- pom = new File( baseDirectory, Maven.POMv4 );
+ pom = new File( baseDirectory, Maven.POMv4 );
}
-
+
if ( pom.exists() )
{
request.setPom( pom );
- }
+ }
if ( commandLine.hasOption( CLIManager.RESUME_FROM ) )
{
Modified:
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
Thu Sep 10 22:05:49 2009
@@ -43,18 +43,18 @@
{
long total = transferEvent.getResource().getContentLength();
complete += length;
-
+
if ( !showEvent( transferEvent ) )
{
return;
}
-
+
// TODO [BP]: Sys.out may no longer be appropriate, but will \r work
with getLogger()?
if ( total >= 1024 )
{
System.out.print(
- ( complete / 1024 ) + "/" + ( total ==
WagonConstants.UNKNOWN_LENGTH ? "?" : ( total / 1024 ) + "K" ) +
- "\r" );
+ ( complete / 1024 ) + "/" + ( total ==
WagonConstants.UNKNOWN_LENGTH ? "?" : ( total / 1024 ) + "K" )
+ + "\r" );
}
else
{
Modified:
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
Thu Sep 10 22:05:49 2009
@@ -1,18 +1,22 @@
package org.apache.maven.embedder.execution;
/*
- * 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;
@@ -62,7 +66,7 @@
}
request.setOffline( settings.isOffline() );
-
+
request.setInteractiveMode( settings.isInteractiveMode() );
request.setPluginGroups( settings.getPluginGroups() );
@@ -114,7 +118,7 @@
// <mirrorOf>*</mirrorOf>
// <url>http://repository.sonatype.org/content/groups/public</url>
// </mirror>
- // </mirrors>
+ // </mirrors>
for ( Mirror mirror : settings.getMirrors() )
{
@@ -320,7 +324,7 @@
populateDefaultPluginGroups( request );
injectDefaultRepositories( request );
-
+
injectDefaultPluginRepositories( request );
processRepositoriesInSettings( request );
Modified:
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractCoreMavenComponentTestCase.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractCoreMavenComponentTestCase.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractCoreMavenComponentTestCase.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractCoreMavenComponentTestCase.java
Thu Sep 10 22:05:49 2009
@@ -39,7 +39,7 @@
@Requirement
protected Maven maven;
-
+
protected void setUp()
throws Exception
{
@@ -75,7 +75,7 @@
* We need to customize the standard Plexus container with the plugin
discovery listener which
* is what looks for the META-INF/maven/plugin.xml resources that enter
the system when a Maven
* plugin is loaded.
- *
+ *
* We also need to customize the Plexus container with a standard plugin
discovery listener
* which is the MavenPluginCollector. When a Maven plugin is discovered
the MavenPluginCollector
* collects the plugin descriptors which are found.
@@ -88,7 +88,7 @@
protected MavenExecutionRequest createMavenExecutionRequest( File pom )
throws Exception
- {
+ {
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
.setPom( pom )
.setProjectPresent( true )
@@ -107,16 +107,16 @@
// a Maven subclass because we don't want to couple maven to the project
builder which we need to
// separate.
protected MavenSession createMavenSession( File pom )
- throws Exception
+ throws Exception
{
return createMavenSession( pom, new Properties() );
}
-
+
protected MavenSession createMavenSession( File pom, Properties
executionProperties )
throws Exception
{
MavenExecutionRequest request = createMavenExecutionRequest( pom );
-
+
ProjectBuildingRequest configuration = new
DefaultProjectBuildingRequest()
.setLocalRepository( request.getLocalRepository() )
.setRemoteRepositories( request.getRemoteRepositories() )
@@ -147,7 +147,7 @@
model.setVersion( "1.0" );
return new MavenProject( model );
}
-
+
protected List<ArtifactRepository> getRemoteRepositories()
throws InvalidRepositoryException
{
@@ -162,28 +162,28 @@
itRepo.setUrl(
"http://repository.sonatype.org/content/repositories/maven.snapshots" );
return Arrays.asList(
repositorySystem.createDefaultRemoteRepository(),
repositorySystem.buildArtifactRepository( itRepo ) );
}
-
- protected ArtifactRepository getLocalRepository()
+
+ protected ArtifactRepository getLocalRepository()
throws InvalidRepositoryException
- {
- return repositorySystem.createDefaultLocalRepository();
+ {
+ return repositorySystem.createDefaultLocalRepository();
}
-
+
protected class ProjectBuilder
{
private MavenProject project;
-
+
public ProjectBuilder( String groupId, String artifactId, String
version )
{
Model model = new Model();
model.setModelVersion( "4.0.0" );
model.setGroupId( groupId );
model.setArtifactId( artifactId );
- model.setVersion( version );
+ model.setVersion( version );
model.setBuild( new Build() );
- project = new MavenProject( model );
+ project = new MavenProject( model );
}
-
+
public ProjectBuilder setGroupId( String groupId )
{
project.setGroupId( groupId );
@@ -195,30 +195,30 @@
project.setArtifactId( artifactId );
return this;
}
-
+
public ProjectBuilder setVersion( String version )
{
project.setVersion( version );
return this;
}
-
+
// Dependencies
//
public ProjectBuilder addDependency( String groupId, String
artifactId, String version, String scope )
{
- return addDependency( groupId, artifactId, version, scope,
(Exclusion)null );
+ return addDependency( groupId, artifactId, version, scope,
(Exclusion) null );
}
-
+
public ProjectBuilder addDependency( String groupId, String
artifactId, String version, String scope, Exclusion exclusion )
{
- return addDependency( groupId, artifactId, version, scope, null,
exclusion );
+ return addDependency( groupId, artifactId, version, scope, null,
exclusion );
}
public ProjectBuilder addDependency( String groupId, String
artifactId, String version, String scope, String systemPath )
{
- return addDependency( groupId, artifactId, version, scope,
systemPath, null );
+ return addDependency( groupId, artifactId, version, scope,
systemPath, null );
}
-
+
public ProjectBuilder addDependency( String groupId, String
artifactId, String version, String scope, String systemPath, Exclusion
exclusion )
{
Dependency d = new Dependency();
@@ -226,60 +226,60 @@
d.setArtifactId( artifactId );
d.setVersion( version );
d.setScope( scope );
-
+
if ( systemPath != null && scope.equals( Artifact.SCOPE_SYSTEM ) )
{
d.setSystemPath( systemPath );
}
-
+
if ( exclusion != null )
{
d.addExclusion( exclusion );
}
-
+
project.getDependencies().add( d );
-
+
return this;
}
-
+
// Plugins
//
public ProjectBuilder addPlugin( Plugin plugin )
{
- project.getBuildPlugins().add( plugin );
+ project.getBuildPlugins().add( plugin );
return this;
}
-
+
public MavenProject get()
{
return project;
- }
- }
-
+ }
+ }
+
protected class PluginBuilder
{
private Plugin plugin;
-
+
public PluginBuilder( String groupId, String artifactId, String
version )
{
plugin = new Plugin();
plugin.setGroupId( groupId );
plugin.setArtifactId( artifactId );
- plugin.setVersion( version );
+ plugin.setVersion( version );
}
-
+
// Dependencies
//
public PluginBuilder addDependency( String groupId, String artifactId,
String version, String scope, Exclusion exclusion )
{
- return addDependency( groupId, artifactId, version, scope,
exclusion );
+ return addDependency( groupId, artifactId, version, scope,
exclusion );
}
public PluginBuilder addDependency( String groupId, String artifactId,
String version, String scope, String systemPath )
{
- return addDependency( groupId, artifactId, version, scope,
systemPath, null );
+ return addDependency( groupId, artifactId, version, scope,
systemPath, null );
}
-
+
public PluginBuilder addDependency( String groupId, String artifactId,
String version, String scope, String systemPath, Exclusion exclusion )
{
Dependency d = new Dependency();
@@ -287,25 +287,25 @@
d.setArtifactId( artifactId );
d.setVersion( version );
d.setScope( scope );
-
+
if ( systemPath != null && scope.equals( Artifact.SCOPE_SYSTEM ) )
{
d.setSystemPath( systemPath );
}
-
+
if ( exclusion != null )
{
d.addExclusion( exclusion );
}
-
+
plugin.getDependencies().add( d );
-
+
return this;
}
-
+
public Plugin get()
{
return plugin;
- }
- }
+ }
+ }
}
Modified:
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java?rev=813615&r1=813614&r2=813615&view=diff
==============================================================================
---
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
(original)
+++
maven/maven-3/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
Thu Sep 10 22:05:49 2009
@@ -86,14 +86,14 @@
}
System.err.println( "Encountered " + exceptions.size() + "
exception(s)." );
- for (Exception exception : exceptions)
+ for ( Exception exception : exceptions )
{
exception.printStackTrace( System.err );
}
fail( "Encountered Exceptions in MavenExecutionResult during " +
getName() );
}
-
+
/*MNG-3919*/
public void testWithInvalidGoal()
throws Exception
@@ -104,16 +104,16 @@
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
- MavenExecutionRequest request = createMavenExecutionRequest( new File(
targetDirectory, "pom.xml" ) );
+ MavenExecutionRequest request = createMavenExecutionRequest( new File(
targetDirectory, "pom.xml" ) );
request.setGoals( Arrays.asList( new String[]{"validate"} ) );
MavenExecutionResult result = mavenEmbedder.execute( request );
List<Exception> exceptions = result.getExceptions();
- assertEquals("Incorrect number of exceptions", 1, exceptions.size());
+ assertEquals( "Incorrect number of exceptions", 1, exceptions.size() );
if ( ( exceptions.get( 0 ) instanceof NullPointerException ) )
{
- fail("Null Pointer on Exception");
+ fail( "Null Pointer on Exception" );
}
}
@@ -147,7 +147,7 @@
writer.close();
MavenExecutionRequest request = createMavenExecutionRequest( pom );
-
+
MavenExecutionResult result = mavenEmbedder.execute( request );
assertNoExceptions( result );
@@ -164,7 +164,7 @@
writer.close();
request = createMavenExecutionRequest( pom );
-
+
result = mavenEmbedder.execute( request );
assertNoExceptions( result );