You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2010/03/21 14:43:09 UTC
svn commit: r925767 [1/2] - in
/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype:
mojos/ ui/
Author: hboutemy
Date: Sun Mar 21 13:43:08 2010
New Revision: 925767
URL: http://svn.apache.org/viewvc?rev=925767&view=rev
Log:
o code formatting
o improved javadoc
Modified:
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelectionQueryer.java
maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeSelector.java
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java Sun Mar 21 13:43:08 2010
@@ -55,8 +55,7 @@ public class AddArchetypeMetadataMojo
private MavenProject project;
public void execute()
- throws
- MojoExecutionException
+ throws MojoExecutionException
{
Artifact projectArtifact = project.getArtifact();
@@ -64,17 +63,11 @@ public class AddArchetypeMetadataMojo
versioning.setLatest( projectArtifact.getVersion() );
versioning.updateTimestamp();
- ArtifactRepositoryMetadata metadata =
- new ArtifactRepositoryMetadata( projectArtifact, versioning );
+ ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
projectArtifact.addMetadata( metadata );
- GroupRepositoryMetadata groupMetadata =
- new GroupRepositoryMetadata( project.getGroupId() );
- groupMetadata.addPluginMapping(
- getGoalPrefix(),
- project.getArtifactId(),
- project.getName()
- );
+ GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata( project.getGroupId() );
+ groupMetadata.addPluginMapping( getGoalPrefix(), project.getArtifactId(), project.getName() );
projectArtifact.addMetadata( groupMetadata );
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java Sun Mar 21 13:43:08 2010
@@ -31,7 +31,7 @@ import java.io.File;
* @author rafale
* @requiresProject false
* //@ //goal clean
- * @deprecated
+ * @deprecated
*/
public class CleanMojo
extends AbstractMojo
@@ -44,9 +44,7 @@ public class CleanMojo
private File propertyFile;
public void execute()
- throws
- MojoExecutionException,
- MojoFailureException
+ throws MojoExecutionException, MojoFailureException
{
propertyFile.delete();
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java Sun Mar 21 13:43:08 2010
@@ -28,8 +28,7 @@ import org.apache.maven.plugin.MojoFailu
import java.io.File;
/**
- * Crawl a Maven 2 repository (Filesystem, not HTTP)
- * and creates a catalog file.
+ * Crawl a Maven 2 repository (filesystem, not HTTP) and creates a catalog file.
*
* @author rafale
* @requiresProject false
@@ -58,22 +57,23 @@ public class CrawlRepositoryMojo
private File repository;
public void execute ()
- throws MojoExecutionException, MojoFailureException
+ throws MojoExecutionException, MojoFailureException
{
System.err.println ( "repository " + repository );
System.err.println ( "catalogFile " + catalogFile );
+
if ( repository == null )
{
- throw new MojoFailureException (
- "The repository is not defined. Use -Drepository=/path/to/repository"
- );
+ throw new MojoFailureException( "The repository is not defined. Use -Drepository=/path/to/repository" );
}
ArchetypeCatalog catalog = crawler.crawl ( repository );
+
if ( catalogFile == null )
{
catalogFile = new File ( repository, "archetype-catalog.xml" );
}
+
crawler.writeCatalog ( catalog, catalogFile );
}
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java Sun Mar 21 13:43:08 2010
@@ -42,7 +42,7 @@ import org.apache.maven.execution.MavenS
import org.codehaus.plexus.util.StringUtils;
/**
- * Creates sample archetype from current project.
+ * Creates an archetype from the current project.
*
* @author rafale
* @requiresProject true
@@ -105,8 +105,8 @@ public class CreateArchetypeFromProjectM
private boolean partialArchetype = false;
/**
- * Create pom's velocity templates with CDATA preservasion. This uses the String replaceAll
- * method and risk to have some overly replacement capabilities (beware of '1.0' value).
+ * Create pom's velocity templates with CDATA preservation. This uses the <code>String.replaceAll()</code>
+ * method and risks to have some overly replacement capabilities (beware of '1.0' value).
*
* @parameter expression="${archetype.preserveCData}"
*/
@@ -140,8 +140,8 @@ public class CreateArchetypeFromProjectM
private File propertyFile;
/**
- * The property telling which phase call on the generated archetype.
- * Interesting values are: package, install and deploy
+ * The property telling which phase to call on the generated archetype.
+ * Interesting values are: <code>package</code>, <code>install</code> and <code>deploy</code>
*
* @parameter expression="${archetype.postPhase}" default-value="package"
*/
@@ -163,9 +163,7 @@ public class CreateArchetypeFromProjectM
private MavenSession session;
public void execute()
- throws
- MojoExecutionException,
- MojoFailureException
+ throws MojoExecutionException, MojoFailureException
{
Properties executionProperties = session.getExecutionProperties();
try
@@ -177,19 +175,11 @@ public class CreateArchetypeFromProjectM
List languages = getLanguages( archetypeLanguages, propertyFile );
- Properties properties = configurator.configureArchetypeCreation(
- project,
- new Boolean( interactive ),
- executionProperties,
- propertyFile,
- languages
- );
-
- List filtereds =
- getFilteredExtensions(
- archetypeFilteredExtentions,
- propertyFile
- );
+ Properties properties =
+ configurator.configureArchetypeCreation( project, Boolean.valueOf( interactive ), executionProperties,
+ propertyFile, languages );
+
+ List filtereds = getFilteredExtensions( archetypeFilteredExtentions, propertyFile );
ArchetypeCreationRequest request = new ArchetypeCreationRequest()
.setProject( project )
@@ -213,11 +203,8 @@ public class CreateArchetypeFromProjectM
if ( result.getCause() != null )
{
- throw new MojoFailureException(
- result.getCause(),
- result.getCause().getMessage(),
- result.getCause().getMessage()
- );
+ throw new MojoFailureException( result.getCause(), result.getCause().getMessage(),
+ result.getCause().getMessage() );
}
getLog().info( "Archetype created in target/generated-sources/archetype" );
@@ -252,10 +239,9 @@ public class CreateArchetypeFromProjectM
if ( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )
{
- filteredExtensions.addAll(
- Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) )
- );
- getLog().debug("Found in command line extensions = " + filteredExtensions);
+ filteredExtensions.addAll( Arrays.asList( StringUtils.split( archetypeFilteredExtentions, "," ) ) );
+
+ getLog().debug( "Found in command line extensions = " + filteredExtensions );
}
if ( filteredExtensions.isEmpty() && propertyFile != null && propertyFile.exists() )
@@ -265,19 +251,17 @@ public class CreateArchetypeFromProjectM
Properties properties = new Properties();
properties.load( new FileInputStream( propertyFile ) );
- String extensions =
- properties.getProperty( Constants.ARCHETYPE_FILTERED_EXTENSIONS );
+ String extensions = properties.getProperty( Constants.ARCHETYPE_FILTERED_EXTENSIONS );
if ( StringUtils.isNotEmpty( extensions ) )
{
- filteredExtensions.addAll(
- Arrays.asList( StringUtils.split( extensions, "," ) )
- );
+ filteredExtensions.addAll( Arrays.asList( StringUtils.split( extensions, "," ) ) );
}
+
getLog().debug(
"Found in propertyFile " + propertyFile.getName() + " extensions = "
+ filteredExtensions );
}
- catch( IOException e )
+ catch ( IOException e )
{
getLog().warn( "Can not read " + propertyFile.getName() );
}
@@ -286,6 +270,7 @@ public class CreateArchetypeFromProjectM
if ( filteredExtensions.isEmpty() )
{
filteredExtensions.addAll( Constants.DEFAULT_FILTERED_EXTENSIONS );
+
getLog().debug( "Using default extensions = " + filteredExtensions );
}
@@ -299,6 +284,7 @@ public class CreateArchetypeFromProjectM
if ( StringUtils.isNotEmpty( archetypeLanguages ) )
{
resultingLanguages.addAll( Arrays.asList( StringUtils.split( archetypeLanguages, "," ) ) );
+
getLog().debug( "Found in command line languages = " + resultingLanguages );
}
@@ -309,14 +295,12 @@ public class CreateArchetypeFromProjectM
Properties properties = new Properties();
properties.load( new FileInputStream( propertyFile ) );
- String languages =
- properties.getProperty( Constants.ARCHETYPE_LANGUAGES );
- if( StringUtils.isNotEmpty( languages ) )
+ String languages = properties.getProperty( Constants.ARCHETYPE_LANGUAGES );
+ if ( StringUtils.isNotEmpty( languages ) )
{
- resultingLanguages.addAll(
- Arrays.asList( StringUtils.split( languages, "," ) )
- );
+ resultingLanguages.addAll( Arrays.asList( StringUtils.split( languages, "," ) ) );
}
+
getLog().debug(
"Found in propertyFile " + propertyFile.getName() + " languages = "
+ resultingLanguages );
@@ -330,6 +314,7 @@ public class CreateArchetypeFromProjectM
if ( resultingLanguages.isEmpty() )
{
resultingLanguages.addAll( Constants.DEFAULT_LANGUAGES );
+
getLog().debug( "Using default languages = " + resultingLanguages );
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java Sun Mar 21 13:43:08 2010
@@ -43,7 +43,7 @@ import java.util.List;
import java.util.Properties;
/**
- * Generates sample project from archetype.
+ * Generates a new project from an archetype.
*
* @author rafale
* @requiresProject false
@@ -101,13 +101,15 @@ public class CreateProjectFromArchetypeM
* The archetype's catalogs.
* It is a comma separated list of catalogs.
* Catalogs use scheme:
- * - 'file://...' with archetype-catalog.xml automatically appended when defining a directory
- * - 'http://...' with archetype-catalog.xml always appended
- * - 'local' which is the shortcut for 'file://~/.m2/archetype-catalog.xml'
- * - 'remote' which is the shortcut for 'http://repo1.maven.org/maven2'
- * - 'internal' which is an internal catalog
+ * <ul>
+ * <li>'<code>file://...</code>' with <code>archetype-catalog.xml</code> automatically appended when pointing to a directory</li>
+ * <li>'<code>http://...</code>' with <code>archetype-catalog.xml</code> always appended</li>
+ * <li>'<code>local</code>' which is the shortcut for '<code>file://~/.m2/archetype-catalog.xml</code>'</li>
+ * <li>'<code>remote</code>' which is the shortcut for '<code>http://repo1.maven.org/maven2</code>'</li>
+ * <li>'<code>internal</code>' which is an internal catalog</li>
+ * </ul>
*
- * Since 2.0-alpha-5, default value is no longer internal,local but remote,local
+ * Since 2.0-alpha-5, default value is no longer <code>internal,local</code> but <code>remote,local</code>.
* This can only work if central has a catalog file at root.
*
* @parameter expression="${archetypeCatalog}" default-value="remote,local"
@@ -148,6 +150,7 @@ public class CreateProjectFromArchetypeM
* @readonly
*/
private MavenSession session;
+
/**
* Additional goals that can be specified by the user during the creation of the archetype.
*
@@ -184,15 +187,12 @@ public class CreateProjectFromArchetypeM
configurator.configureArchetype( request, interactiveMode, executionProperties );
- ArchetypeGenerationResult generationResult =
- archetype.generateProjectFromArchetype( request );
+ ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype( request );
+
if ( generationResult.getCause() != null )
{
- throw new MojoFailureException(
- generationResult.getCause(),
- generationResult.getCause().getMessage(),
- generationResult.getCause().getMessage()
- );
+ throw new MojoFailureException( generationResult.getCause(), generationResult.getCause().getMessage(),
+ generationResult.getCause().getMessage() );
}
}
catch ( MojoFailureException ex )
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java Sun Mar 21 13:43:08 2010
@@ -75,23 +75,19 @@ public class IntegrationTestMojo
private boolean skip = false;
public void execute()
- throws
- MojoExecutionException,
- MojoFailureException
+ throws MojoExecutionException, MojoFailureException
{
if ( !skip )
{
try
{
- File projectsDirectory =
- new File( project.getBasedir(), "target/test-classes/projects" );
+ File projectsDirectory = new File( project.getBasedir(), "target/test-classes/projects" );
if ( projectsDirectory.exists() )
{
File archetypeFile = project.getArtifact().getFile();
- List projectsGoalFiles =
- FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );
+ List projectsGoalFiles = FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );
Iterator goalFiles = projectsGoalFiles.iterator();
@@ -106,10 +102,7 @@ public class IntegrationTestMojo
}
catch ( IntegrationTestFailure ex )
{
- errorWriter.write(
- "Test " + goalFile.getParentFile().getName() + " failed\n"
- );
-
+ errorWriter.write( "Test " + goalFile.getParentFile().getName() + " failed\n" );
errorWriter.write( ex.getStackTrace() + "\n" );
errorWriter.write( ex.getMessage() + "\n" );
errorWriter.write( "\n" );
@@ -130,21 +123,16 @@ public class IntegrationTestMojo
}
}
- private void assertTest( File reference,
- File basedir )
- throws
- IntegrationTestFailure,
- IOException
+ private void assertTest( File reference, File basedir )
+ throws IntegrationTestFailure, IOException
{
List referenceFiles = FileUtils.getFileNames( reference, "**", null, false );
List projectFiles = FileUtils.getFileNames( basedir, "**", null, false );
- boolean fileNamesEquals =
- CollectionUtils.isEqualCollection( referenceFiles, projectFiles );
+ boolean fileNamesEquals = CollectionUtils.isEqualCollection( referenceFiles, projectFiles );
{
- Iterator refs = referenceFiles.iterator();
- while ( refs.hasNext() )
+ for ( Iterator refs = referenceFiles.iterator(); refs.hasNext(); )
{
String ref = (String) refs.next();
@@ -167,8 +155,8 @@ public class IntegrationTestMojo
}
boolean contentEquals = true;
- Iterator files = referenceFiles.iterator();
- while ( files.hasNext() )
+
+ for ( Iterator files = referenceFiles.iterator(); files.hasNext(); )
{
String file = (String) files.next();
@@ -182,11 +170,7 @@ public class IntegrationTestMojo
}
else
{
- if ( !FileUtils.contentEquals(
- new File( reference, file ),
- new File( basedir, file )
- )
- )
+ if ( !FileUtils.contentEquals( new File( reference, file ), new File( basedir, file ) ) )
{
getLog().warn( "Contents of file " + file + " are not equal" );
contentEquals = false;
@@ -200,9 +184,7 @@ public class IntegrationTestMojo
}
private Properties loadProperties( final File propertiesFile )
- throws
- IOException,
- FileNotFoundException
+ throws IOException, FileNotFoundException
{
Properties properties = new Properties();
@@ -211,18 +193,14 @@ public class IntegrationTestMojo
return properties;
}
- private boolean modelEquals( File referencePom,
- File generatedPom )
- throws
- IOException
+ private boolean modelEquals( File referencePom, File generatedPom )
+ throws IOException
{
return FileUtils.contentEquals( referencePom, generatedPom );
}
- private void processIntegrationTest( File goalFile,
- File archetypeFile )
- throws
- IntegrationTestFailure
+ private void processIntegrationTest( File goalFile, File archetypeFile )
+ throws IntegrationTestFailure
{
try
{
@@ -233,15 +211,12 @@ public class IntegrationTestMojo
String basedir = goalFile.getParentFile().getPath() + "/project";
FileUtils.mkdir( basedir );
-//TODO: fix this to use request
+ // TODO: fix this to use request
filesetGenerator.generateArchetype( null, archetypeFile, basedir );
File reference = new File( goalFile.getParentFile(), "reference" );
- assertTest(
- reference,
- new File( basedir, properties.getProperty( Constants.ARTIFACT_ID ) )
- );
+ assertTest( reference, new File( basedir, properties.getProperty( Constants.ARTIFACT_ID ) ) );
}
catch ( ArchetypeNotConfigured ex )
{
@@ -274,8 +249,7 @@ public class IntegrationTestMojo
}
private Properties getProperties( File goalFile )
- throws
- IOException
+ throws IOException
{
File propertiesFile = new File( goalFile.getParentFile(), "archetype.properties" );
@@ -283,8 +257,7 @@ public class IntegrationTestMojo
}
private Properties getTestProperties( File goalFile )
- throws
- IOException
+ throws IOException
{
return loadProperties( goalFile );
}
@@ -307,8 +280,7 @@ public class IntegrationTestMojo
super( cause );
}
- IntegrationTestFailure( String message,
- Throwable cause )
+ IntegrationTestFailure( String message, Throwable cause )
{
super( message, cause );
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/MavenArchetypeMojo.java Sun Mar 21 13:43:08 2010
@@ -39,7 +39,7 @@ import java.util.List;
import java.util.Map;
/**
- * The archetype creation goal looks for an archetype with a given groupId,
+ * The archetype creation goal looks for an archetype with a given groupId,
* artifactId, and version and retrieves it from the remote repository. Once the
* archetype is retrieved, it is then processed against a set of user parameters
* to create a working Maven project.
@@ -53,9 +53,9 @@ public class MavenArchetypeMojo
extends AbstractMojo
{
/**
- * Used to create the Archetype specified by the groupId, artifactId, and
+ * Used to create the Archetype specified by the groupId, artifactId, and
* version from the remote repository.
- *
+ *
* @component
*/
private OldArchetype archetype;
@@ -63,14 +63,14 @@ public class MavenArchetypeMojo
/**
* Used to create ArtifactRepository objects given the urls of the remote
* repositories.
- *
+ *
* @component
*/
private ArtifactRepositoryFactory artifactRepositoryFactory;
/**
* Determines whether the layout is legacy or not.
- *
+ *
* @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout" roleHint="default"
*/
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
@@ -78,7 +78,7 @@ public class MavenArchetypeMojo
/**
* Maven's local repository.
- *
+ *
* @parameter expression="${localRepository}"
* @required
*/
@@ -86,7 +86,7 @@ public class MavenArchetypeMojo
/**
* The Archetype Group Id to be used.
- *
+ *
* @parameter expression="${archetypeGroupId}" default-value="org.apache.maven.archetypes"
* @required
*/
@@ -94,7 +94,7 @@ public class MavenArchetypeMojo
/**
* The Archetype Artifact Id to be used.
- *
+ *
* @parameter expression="${archetypeArtifactId}" default-value="maven-archetype-quickstart"
* @required
*/
@@ -102,7 +102,7 @@ public class MavenArchetypeMojo
/**
* The Archetype Version to be used.
- *
+ *
* @parameter expression="${archetypeVersion}" default-value="RELEASE"
* @required
*/
@@ -110,21 +110,21 @@ public class MavenArchetypeMojo
/**
* The Group Id of the project to be build.
- *
+ *
* @parameter expression="${groupId}"
*/
private String groupId;
/**
* The Artifact Id of the project to be build.
- *
+ *
* @parameter expression="${artifactId}"
*/
private String artifactId;
/**
* The Version of the project to be build.
- *
+ *
* @parameter expression="${version}" default-value="1.0-SNAPSHOT"
* @required
*/
@@ -132,7 +132,7 @@ public class MavenArchetypeMojo
/**
* The Package Name of the project to be build.
- *
+ *
* @parameter expression="${packageName}" alias="package"
*/
private String packageName;
@@ -140,7 +140,7 @@ public class MavenArchetypeMojo
/**
* The remote repositories available for discovering dependencies and extensions as indicated
* by the POM.
- *
+ *
* @parameter expression="${project.remoteArtifactRepositories}"
* @required
*/
@@ -148,14 +148,14 @@ public class MavenArchetypeMojo
/**
* Other remote repositories available for discovering dependencies and extensions.
- *
+ *
* @parameter expression="${remoteRepositories}"
*/
private String remoteRepositories;
/**
* The project to be created an archetype of.
- *
+ *
* @parameter expression="${project}"
*/
private MavenProject project;
@@ -195,19 +195,19 @@ public class MavenArchetypeMojo
}
// TODO: context mojo more appropriate?
- Map map = new HashMap();
+ Map parameters = new HashMap();
- map.put( "basedir", basedir );
+ parameters.put( "basedir", basedir );
- map.put( "package", packageName );
+ parameters.put( "package", packageName );
- map.put( "packageName", packageName );
+ parameters.put( "packageName", packageName );
- map.put( "groupId", groupId );
+ parameters.put( "groupId", groupId );
- map.put( "artifactId", artifactId );
+ parameters.put( "artifactId", artifactId );
- map.put( "version", version );
+ parameters.put( "version", version );
List archetypeRemoteRepositories = new ArrayList( pomRemoteRepositories );
@@ -227,16 +227,11 @@ public class MavenArchetypeMojo
try
{
- archetype.createArchetype(
- archetypeGroupId,
- archetypeArtifactId,
- archetypeVersion,
- createRepository("http://repo1.maven.org/maven2", "central"),
- localRepository,
- archetypeRemoteRepositories,
- map);
+ archetype.createArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion,
+ createRepository( "http://repo1.maven.org/maven2", "central" ), localRepository,
+ archetypeRemoteRepositories, parameters );
}
- catch (UnknownArchetype e)
+ catch (UnknownArchetype e)
{
throw new MojoExecutionException( "Error creating from archetype", e );
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java Sun Mar 21 13:43:08 2010
@@ -85,6 +85,7 @@ public class UpdateLocalCatalogMojo
archetype.setGroupId( project.getGroupId() );
archetype.setArtifactId( project.getArtifactId() );
archetype.setVersion( project.getVersion() );
+
if ( StringUtils.isNotEmpty( project.getDescription() ) )
{
archetype.setDescription( project.getDescription() );
@@ -93,6 +94,7 @@ public class UpdateLocalCatalogMojo
{
archetype.setDescription( project.getName() );
}
+
// archetype.setRepository( localRepository.toString() );
// archetype.setGoals( project.get );
// archetype.setProperties( project.get );
@@ -140,7 +142,7 @@ public class UpdateLocalCatalogMojo
private Properties getArchetypeSourceProperties( String sourceRoleHint, Properties archetypeCatalogProperties )
{
- Properties p = new Properties( );
+ Properties p = new Properties();
for ( Iterator i = archetypeCatalogProperties.keySet().iterator(); i.hasNext(); )
{
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationConfigurator.java Sun Mar 21 13:43:08 2010
@@ -35,18 +35,8 @@ public interface ArchetypeCreationConfig
{
String ROLE = ArchetypeCreationConfigurator.class.getName();
- Properties configureArchetypeCreation(
- MavenProject project,
- Boolean interactiveMode,
- Properties commandLineProperties,
- File propertyFile,
- List languages
- )
- throws
- FileNotFoundException,
- IOException,
- ArchetypeNotDefined,
- ArchetypeNotConfigured,
- PrompterException,
+ Properties configureArchetypeCreation( MavenProject project, Boolean interactiveMode,
+ Properties commandLineProperties, File propertyFile, List languages )
+ throws FileNotFoundException, IOException, ArchetypeNotDefined, ArchetypeNotConfigured, PrompterException,
TemplateCreationException;
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeCreationQueryer.java Sun Mar 21 13:43:08 2010
@@ -29,67 +29,55 @@ public interface ArchetypeCreationQuerye
/**
*/
String getArchetypeArtifactId( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getArchetypeGroupId( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getArchetypeVersion( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getArtifactId( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
boolean askAddAnotherProperty()
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String askNewPropertyKey()
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
- String askReplacementValue( String propertyKey,
- String defaultValue )
- throws
- PrompterException;
+ String askReplacementValue( String propertyKey, String defaultValue )
+ throws PrompterException;
/**
*/
boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getGroupId( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getPackage( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
/**
*/
String getVersion( String defaultValue )
- throws
- PrompterException;
+ throws PrompterException;
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java Sun Mar 21 13:43:08 2010
@@ -29,35 +29,27 @@ public interface ArchetypeFactory
{
String ROLE = ArchetypeFactory.class.getName();
-
/**
*/
ArchetypeConfiguration createArchetypeConfiguration(
- org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor,
- Properties properties
- );
+ org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor,
+ Properties properties );
/**
*/
ArchetypeConfiguration createArchetypeConfiguration(
- org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
- Properties properties
- );
+ org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
+ Properties properties );
/**
*/
- ArchetypeConfiguration createArchetypeConfiguration(
- MavenProject project,
- ArchetypeDefinition archetypeDefinition,
- Properties properties
- );
+ ArchetypeConfiguration createArchetypeConfiguration( MavenProject project, ArchetypeDefinition archetypeDefinition,
+ Properties properties );
/**
*/
ArchetypeDefinition createArchetypeDefinition( Properties properties );
- void updateArchetypeConfiguration(
- ArchetypeConfiguration archetypeConfiguration,
- ArchetypeDefinition archetypeDefinition
- );
+ void updateArchetypeConfiguration( ArchetypeConfiguration archetypeConfiguration,
+ ArchetypeDefinition archetypeDefinition );
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationConfigurator.java Sun Mar 21 13:43:08 2010
@@ -33,15 +33,8 @@ public interface ArchetypeGenerationConf
{
String ROLE = ArchetypeGenerationConfigurator.class.getName();
- public void configureArchetype(
- ArchetypeGenerationRequest request,
- Boolean interactiveMode,
- Properties commandLineProperties )
- throws
- ArchetypeNotDefined,
- UnknownArchetype,
- ArchetypeNotConfigured,
- IOException,
- PrompterException,
+ public void configureArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode,
+ Properties commandLineProperties )
+ throws ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, IOException, PrompterException,
ArchetypeGenerationConfigurationFailure;
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeGenerationQueryer.java Sun Mar 21 13:43:08 2010
@@ -25,11 +25,8 @@ import org.codehaus.plexus.components.in
public interface ArchetypeGenerationQueryer
{
boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
- throws
- PrompterException;
+ throws PrompterException;
- String getPropertyValue( String requiredProperty,
- String defaultValue )
- throws
- PrompterException;
+ String getPropertyValue( String requiredProperty, String defaultValue )
+ throws PrompterException;
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java Sun Mar 21 13:43:08 2010
@@ -14,11 +14,12 @@ import org.codehaus.plexus.components.in
import org.codehaus.plexus.util.StringUtils;
/**
- *
* @author raphaelpieroni
* @plexus.component role-hint="archetype"
*/
-public class ArchetypePrompter implements Prompter {
+public class ArchetypePrompter
+ implements Prompter
+{
/**
* @plexus.requirement
@@ -164,24 +165,11 @@ public class ArchetypePrompter implement
StringBuffer formatted = new StringBuffer( message.length() * 2 );
formatted.append( message );
- /*if ( possibleValues != null && !possibleValues.isEmpty() )
- {
- formatted.append( " (" );
-
- for ( Iterator it = possibleValues.iterator(); it.hasNext(); )
- {
- String possibleValue = (String) it.next();
-
- formatted.append( possibleValue );
-
- if ( it.hasNext() )
- {
- formatted.append( '/' );
- }
- }
-
- formatted.append( ')' );
- }*/
+ /*
+ * if ( possibleValues != null && !possibleValues.isEmpty() ) { formatted.append( " (" ); for ( Iterator it =
+ * possibleValues.iterator(); it.hasNext(); ) { String possibleValue = (String) it.next(); formatted.append(
+ * possibleValue ); if ( it.hasNext() ) { formatted.append( '/' ); } } formatted.append( ')' ); }
+ */
if ( defaultReply != null )
{
@@ -211,5 +199,4 @@ public class ArchetypePrompter implement
}
-
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectionQueryer.java Sun Mar 21 13:43:08 2010
@@ -36,8 +36,7 @@ public interface ArchetypeSelectionQuery
throws PrompterException;
boolean confirmSelection( ArchetypeDefinition archetypeDefinition )
- throws
- PrompterException;
+ throws PrompterException;
// Archetype selectArchetype( List list )
// throws
@@ -61,7 +60,8 @@ public interface ArchetypeSelectionQuery
* @param archetypes the archetypes to choose from
* @param defaultDefinition the default archetype, if present in the map
* @return the selected archetype
- * @throws org.codehaus.plexus.components.interactivity.PrompterException if there is a problem in making a selection
+ * @throws org.codehaus.plexus.components.interactivity.PrompterException if there is a problem in making a
+ * selection
*/
Archetype selectArchetype( Map archetypes, ArchetypeDefinition defaultDefinition )
throws PrompterException;
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelector.java Sun Mar 21 13:43:08 2010
@@ -47,11 +47,6 @@ public interface ArchetypeSelector
// ArchetypeSelectionFailure;
void selectArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs )
- throws
- ArchetypeNotDefined,
- UnknownArchetype,
- UnknownGroup,
- IOException,
- PrompterException,
+ throws ArchetypeNotDefined, UnknownArchetype, UnknownGroup, IOException, PrompterException,
ArchetypeSelectionFailure;
}
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationConfigurator.java Sun Mar 21 13:43:08 2010
@@ -58,25 +58,13 @@ public class DefaultArchetypeCreationCon
/** @plexus.requirement */
private ArchetypeFilesResolver archetypeFilesResolver;
- public Properties configureArchetypeCreation(
- MavenProject project,
- Boolean interactiveMode,
- Properties commandLineProperties,
- File propertyFile,
- List languages
- )
- throws
- IOException,
- ArchetypeNotDefined,
- ArchetypeNotConfigured,
- PrompterException,
- TemplateCreationException
+ public Properties configureArchetypeCreation( MavenProject project, Boolean interactiveMode,
+ Properties commandLineProperties, File propertyFile, List languages )
+ throws IOException, ArchetypeNotDefined, ArchetypeNotConfigured, PrompterException, TemplateCreationException
{
- Properties properties =
- initialiseArchetypeProperties( commandLineProperties, propertyFile );
+ Properties properties = initialiseArchetypeProperties( commandLineProperties, propertyFile );
- ArchetypeDefinition archetypeDefinition =
- archetypeFactory.createArchetypeDefinition( properties );
+ ArchetypeDefinition archetypeDefinition = archetypeFactory.createArchetypeDefinition( properties );
if ( !archetypeDefinition.isDefined() )
{
@@ -84,24 +72,14 @@ public class DefaultArchetypeCreationCon
}
ArchetypeConfiguration archetypeConfiguration =
- archetypeFactory.createArchetypeConfiguration(
- project,
- archetypeDefinition,
- properties
- );
+ archetypeFactory.createArchetypeConfiguration( project, archetypeDefinition, properties );
- String resolvedPackage =
- archetypeFilesResolver.resolvePackage( project.getBasedir(), languages );
+ String resolvedPackage = archetypeFilesResolver.resolvePackage( project.getBasedir(), languages );
if ( !archetypeConfiguration.isConfigured() )
{
archetypeConfiguration =
- defineDefaultConfiguration(
- project,
- archetypeDefinition,
- resolvedPackage,
- properties
- );
+ defineDefaultConfiguration( project, archetypeDefinition, resolvedPackage, properties );
}
if ( interactiveMode.booleanValue() )
@@ -111,85 +89,62 @@ public class DefaultArchetypeCreationCon
boolean confirmed = false;
while ( !confirmed )
{
- if ( !archetypeDefinition.isDefined() )//<editor-fold text="...">
+ if ( !archetypeDefinition.isDefined() )// <editor-fold text="...">
{
getLogger().debug( "Archetype is yet not defined" );
if ( !archetypeDefinition.isGroupDefined() )
{
getLogger().debug( "Asking for archetype's groupId" );
- archetypeDefinition.setGroupId(
- archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() )
- );
+ archetypeDefinition.setGroupId( archetypeCreationQueryer.getArchetypeGroupId( project.getGroupId() ) );
}
if ( !archetypeDefinition.isArtifactDefined() )
{
getLogger().debug( "Asking for archetype's artifactId" );
- archetypeDefinition.setArtifactId(
- archetypeCreationQueryer.getArchetypeArtifactId(
- project.getArtifactId() + Constants.ARCHETYPE_SUFFIX
- )
- );
+ archetypeDefinition.setArtifactId( archetypeCreationQueryer.getArchetypeArtifactId( project.getArtifactId()
+ + Constants.ARCHETYPE_SUFFIX ) );
}
if ( !archetypeDefinition.isVersionDefined() )
{
getLogger().debug( "Asking for archetype's version" );
- archetypeDefinition.setVersion(
- archetypeCreationQueryer.getArchetypeVersion( project.getVersion() )
- );
+ archetypeDefinition.setVersion( archetypeCreationQueryer.getArchetypeVersion( project.getVersion() ) );
}
- archetypeFactory.updateArchetypeConfiguration(
- archetypeConfiguration,
- archetypeDefinition
- );
- }//</editor-fold>
+ archetypeFactory.updateArchetypeConfiguration( archetypeConfiguration, archetypeDefinition );
+ }// </editor-fold>
- if ( !archetypeConfiguration.isConfigured() )//<editor-fold text="...">
+ if ( !archetypeConfiguration.isConfigured() )// <editor-fold text="...">
{
getLogger().debug( "Archetype is not yet configured" );
if ( !archetypeConfiguration.isConfigured( Constants.GROUP_ID ) )
{
getLogger().debug( "Asking for project's groupId" );
archetypeConfiguration.setProperty(
- Constants.GROUP_ID,
- archetypeCreationQueryer.getGroupId(
- archetypeConfiguration.getDefaultValue( Constants.GROUP_ID )
- )
- );
+ Constants.GROUP_ID,
+ archetypeCreationQueryer.getGroupId( archetypeConfiguration.getDefaultValue( Constants.GROUP_ID ) ) );
}
if ( !archetypeConfiguration.isConfigured( Constants.ARTIFACT_ID ) )
{
getLogger().debug( "Asking for project's artifactId" );
archetypeConfiguration.setProperty(
- Constants.ARTIFACT_ID,
- archetypeCreationQueryer.getArtifactId(
- archetypeConfiguration.getDefaultValue( Constants.ARTIFACT_ID )
- )
- );
+ Constants.ARTIFACT_ID,
+ archetypeCreationQueryer.getArtifactId( archetypeConfiguration.getDefaultValue( Constants.ARTIFACT_ID ) ) );
}
if ( !archetypeConfiguration.isConfigured( Constants.VERSION ) )
{
getLogger().debug( "Asking for project's version" );
archetypeConfiguration.setProperty(
- Constants.VERSION,
- archetypeCreationQueryer.getVersion(
- archetypeConfiguration.getDefaultValue( Constants.VERSION )
- )
- );
+ Constants.VERSION,
+ archetypeCreationQueryer.getVersion( archetypeConfiguration.getDefaultValue( Constants.VERSION ) ) );
}
if ( !archetypeConfiguration.isConfigured( Constants.PACKAGE ) )
{
getLogger().debug( "Asking for project's package" );
archetypeConfiguration.setProperty(
- Constants.PACKAGE,
- archetypeCreationQueryer.getPackage(
- StringUtils.isEmpty( resolvedPackage )
- ? archetypeConfiguration.getDefaultValue( Constants.PACKAGE )
- : resolvedPackage
- )
- );
+ Constants.PACKAGE,
+ archetypeCreationQueryer.getPackage( StringUtils.isEmpty( resolvedPackage ) ? archetypeConfiguration.getDefaultValue( Constants.PACKAGE )
+ : resolvedPackage ) );
}
- }//</editor-fold>
+ }// </editor-fold>
boolean stopAddingProperties = false;
while ( !stopAddingProperties )
@@ -206,9 +161,8 @@ public class DefaultArchetypeCreationCon
String replacementValue =
archetypeCreationQueryer.askReplacementValue(
- propertyKey,
- archetypeConfiguration.getDefaultValue( propertyKey )
- );
+ propertyKey,
+ archetypeConfiguration.getDefaultValue( propertyKey ) );
archetypeConfiguration.setDefaultProperty( propertyKey, replacementValue );
archetypeConfiguration.setProperty( propertyKey, replacementValue );
}
@@ -243,10 +197,7 @@ public class DefaultArchetypeCreationCon
return archetypeConfiguration.toProperties();
}
- private ArchetypeDefinition defineDefaultArchetype(
- MavenProject project,
- Properties properties
- )
+ private ArchetypeDefinition defineDefaultArchetype( MavenProject project, Properties properties )
{
if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_GROUP_ID ) ) )
{
@@ -254,10 +205,8 @@ public class DefaultArchetypeCreationCon
}
if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) )
{
- properties.setProperty(
- Constants.ARCHETYPE_ARTIFACT_ID,
- project.getArtifactId() + Constants.ARCHETYPE_SUFFIX
- );
+ properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()
+ + Constants.ARCHETYPE_SUFFIX );
}
if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) )
{
@@ -267,12 +216,9 @@ public class DefaultArchetypeCreationCon
return archetypeFactory.createArchetypeDefinition( properties );
}
- private ArchetypeConfiguration defineDefaultConfiguration(
- MavenProject project,
- ArchetypeDefinition archetypeDefinition,
- String resolvedPackage,
- Properties properties
- )
+ private ArchetypeConfiguration defineDefaultConfiguration( MavenProject project,
+ ArchetypeDefinition archetypeDefinition,
+ String resolvedPackage, Properties properties )
{
if ( StringUtils.isEmpty( properties.getProperty( Constants.GROUP_ID ) ) )
{
@@ -301,7 +247,8 @@ public class DefaultArchetypeCreationCon
if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_ARTIFACT_ID ) ) )
{
getLogger().info( "Setting default archetype's artifactId: " + project.getArtifactId() );
- properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()+Constants.ARCHETYPE_SUFFIX );
+ properties.setProperty( Constants.ARCHETYPE_ARTIFACT_ID, project.getArtifactId()
+ + Constants.ARCHETYPE_SUFFIX );
}
if ( StringUtils.isEmpty( properties.getProperty( Constants.ARCHETYPE_VERSION ) ) )
@@ -310,35 +257,22 @@ public class DefaultArchetypeCreationCon
properties.setProperty( Constants.ARCHETYPE_VERSION, project.getVersion() );
}
- if ( StringUtils.isEmpty(
- properties.getProperty(
- Constants.PACKAGE/*,
- properties.getProperty ( Constants.PACKAGE_NAME )*/
- )
- )
- )
+ if ( StringUtils.isEmpty( properties.getProperty( Constants.PACKAGE /*, properties.getProperty ( Constants.PACKAGE_NAME ) */ ) ) )
{
if ( StringUtils.isEmpty( resolvedPackage ) )
{
resolvedPackage = project.getGroupId();
}
getLogger().info( "Setting default package: " + resolvedPackage );
- /*properties.setProperty ( Constants.PACKAGE_NAME, resolvedPackage );*/
+ /* properties.setProperty ( Constants.PACKAGE_NAME, resolvedPackage ); */
properties.setProperty( Constants.PACKAGE, resolvedPackage );
}
- return
- archetypeFactory.createArchetypeConfiguration(
- project,
- archetypeDefinition,
- properties
- );
+ return archetypeFactory.createArchetypeConfiguration( project, archetypeDefinition, properties );
}
- public void readProperties( Properties properties,
- File propertyFile )
- throws
- IOException
+ public void readProperties( Properties properties, File propertyFile )
+ throws IOException
{
getLogger().debug( "Reading property file " + propertyFile );
@@ -356,10 +290,8 @@ public class DefaultArchetypeCreationCon
}
}
- public void writeProperties( Properties properties,
- File propertyFile )
- throws
- IOException
+ public void writeProperties( Properties properties, File propertyFile )
+ throws IOException
{
Properties storedProperties = new Properties();
try
@@ -394,12 +326,8 @@ public class DefaultArchetypeCreationCon
}
}
- private Properties initialiseArchetypeProperties(
- Properties commandLineProperties,
- File propertyFile
- )
- throws
- IOException
+ private Properties initialiseArchetypeProperties( Properties commandLineProperties, File propertyFile )
+ throws IOException
{
Properties properties = new Properties();
@@ -421,8 +349,8 @@ public class DefaultArchetypeCreationCon
private Properties removeDottedProperties( Properties properties )
{
List toRemove = new ArrayList( 0 );
- Iterator keys = properties.keySet().iterator();
- while ( keys.hasNext() )
+
+ for ( Iterator keys = properties.keySet().iterator(); keys.hasNext(); )
{
String key = (String) keys.next();
if ( key.indexOf( "." ) >= 0 )
@@ -430,10 +358,11 @@ public class DefaultArchetypeCreationCon
toRemove.add( key );
}
}
- Iterator keysToRemove = toRemove.iterator();
- while ( keysToRemove.hasNext() )
+
+ for ( Iterator keysToRemove = toRemove.iterator(); keysToRemove.hasNext(); )
{
String key = (String) keysToRemove.next();
+
properties.remove( key );
}
return properties;
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeCreationQueryer.java Sun Mar 21 13:43:08 2010
@@ -36,36 +36,31 @@ public class DefaultArchetypeCreationQue
private Prompter prompter;
public String getArchetypeArtifactId( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.ARCHETYPE_ARTIFACT_ID, defaultValue );
}
public String getArchetypeGroupId( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.ARCHETYPE_GROUP_ID, defaultValue );
}
public String getArchetypeVersion( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.ARCHETYPE_VERSION, defaultValue );
}
public String getArtifactId( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.ARTIFACT_ID, defaultValue );
}
public boolean askAddAnotherProperty()
- throws
- PrompterException
+ throws PrompterException
{
String query = "Add a new custom property";
@@ -75,8 +70,7 @@ public class DefaultArchetypeCreationQue
}
public String askNewPropertyKey()
- throws
- PrompterException
+ throws PrompterException
{
String query = "Define property key";
@@ -85,27 +79,23 @@ public class DefaultArchetypeCreationQue
return answer;
}
- public String askReplacementValue( String propertyKey,
- String defaultValue )
- throws
- PrompterException
+ public String askReplacementValue( String propertyKey, String defaultValue )
+ throws PrompterException
{
return getValue( propertyKey, defaultValue );
}
public boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
- throws
- PrompterException
+ throws PrompterException
{
- String query = "Confirm archetype configuration:\n";
- query += Constants.ARCHETYPE_GROUP_ID + "=" + archetypeConfiguration.getGroupId() + "\n";
- query +=
- Constants.ARCHETYPE_ARTIFACT_ID + "=" + archetypeConfiguration.getArtifactId() + "\n";
- query += Constants.ARCHETYPE_VERSION + "=" + archetypeConfiguration.getVersion() + "\n";
+ String query =
+ "Confirm archetype configuration:\n" + Constants.ARCHETYPE_GROUP_ID + "="
+ + archetypeConfiguration.getGroupId() + "\n" + Constants.ARCHETYPE_ARTIFACT_ID + "="
+ + archetypeConfiguration.getArtifactId() + "\n" + Constants.ARCHETYPE_VERSION + "="
+ + archetypeConfiguration.getVersion() + "\n";
- Iterator propertiesIter = archetypeConfiguration.getProperties().keySet().iterator();
-
- while ( propertiesIter.hasNext() )
+ for ( Iterator propertiesIter = archetypeConfiguration.getProperties().keySet().iterator();
+ propertiesIter.hasNext(); )
{
String property = (String) propertiesIter.next();
query += property + "=" + archetypeConfiguration.getProperty( property ) + "\n";
@@ -117,30 +107,25 @@ public class DefaultArchetypeCreationQue
}
public String getGroupId( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.GROUP_ID, defaultValue );
}
public String getPackage( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.PACKAGE, defaultValue );
}
public String getVersion( String defaultValue )
- throws
- PrompterException
+ throws PrompterException
{
return getValue( Constants.VERSION, defaultValue );
}
- private String getValue( String requiredProperty,
- String defaultValue )
- throws
- PrompterException
+ private String getValue( String requiredProperty, String defaultValue )
+ throws PrompterException
{
String query = "Define value for " + requiredProperty + ": ";
String answer;
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java Sun Mar 21 13:43:08 2010
@@ -46,10 +46,10 @@ public class DefaultArchetypeFactory
configuration.setArtifactId( archetypeDefinition.getArtifactId() );
configuration.setVersion( archetypeDefinition.getVersion() );
- Iterator propertiesIterator = properties.keySet().iterator();
- while ( propertiesIterator.hasNext() )
+ for ( Iterator propertiesIterator = properties.keySet().iterator(); propertiesIterator.hasNext(); )
{
String property = (String) propertiesIterator.next();
+
if ( !Constants.ARCHETYPE_GROUP_ID.equals( property ) && !Constants.ARCHETYPE_ARTIFACT_ID.equals( property )
&& !Constants.ARCHETYPE_VERSION.equals( property ) )
{
@@ -143,9 +143,8 @@ public class DefaultArchetypeFactory
configuration.setName( archetypeDescriptor.getName() );
- Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
-
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = archetypeDescriptor.getRequiredProperties().iterator();
+ requiredProperties.hasNext(); )
{
org.apache.maven.archetype.metadata.RequiredProperty requiredProperty =
(org.apache.maven.archetype.metadata.RequiredProperty) requiredProperties.next();
@@ -167,7 +166,7 @@ public class DefaultArchetypeFactory
getLogger().debug( "Setting defaultProperty " + requiredProperty.getKey() + "="
+ configuration.getDefaultValue( requiredProperty.getKey() ) );
}
- } // end while
+ }
if ( !configuration.isConfigured( Constants.GROUP_ID )
&& null == configuration.getDefaultValue( Constants.GROUP_ID ) )
@@ -185,6 +184,7 @@ public class DefaultArchetypeFactory
getLogger().debug( "Setting property " + Constants.GROUP_ID + "="
+ configuration.getProperty( Constants.GROUP_ID ) );
}
+
if ( !configuration.isConfigured( Constants.ARTIFACT_ID )
&& null == configuration.getDefaultValue( Constants.ARTIFACT_ID ) )
{
@@ -202,6 +202,7 @@ public class DefaultArchetypeFactory
getLogger().debug( "Setting property " + Constants.ARTIFACT_ID + "="
+ configuration.getProperty( Constants.ARTIFACT_ID ) );
}
+
if ( !configuration.isConfigured( Constants.VERSION )
&& null == configuration.getDefaultValue( Constants.VERSION ) )
{
@@ -222,6 +223,7 @@ public class DefaultArchetypeFactory
getLogger().debug( "Setting property " + Constants.VERSION + "="
+ configuration.getProperty( Constants.VERSION ) );
}
+
if ( !configuration.isConfigured( Constants.PACKAGE )
&& null == configuration.getDefaultValue( Constants.PACKAGE ) )
{
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationConfigurator.java Sun Mar 21 13:43:08 2010
@@ -84,12 +84,8 @@ public class DefaultArchetypeGenerationC
}
public void configureArchetype( ArchetypeGenerationRequest request, Boolean interactiveMode,
- Properties executionProperties )
- throws ArchetypeNotDefined,
- UnknownArchetype,
- ArchetypeNotConfigured,
- IOException,
- PrompterException,
+ Properties executionProperties )
+ throws ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, IOException, PrompterException,
ArchetypeGenerationConfigurationFailure
{
ArtifactRepository localRepository = request.getLocalRepository();
@@ -121,8 +117,9 @@ public class DefaultArchetypeGenerationC
}
if ( request.getArchetypeRepository() != null )
{
- archetypeRepository = archetypeRegistryManager.createRepository( request.getArchetypeRepository(),
- ad.getArtifactId() + "-repo" );
+ archetypeRepository =
+ archetypeRegistryManager.createRepository( request.getArchetypeRepository(),
+ ad.getArtifactId() + "-repo" );
repositories.add( archetypeRepository );
}
if ( request.getRemoteArtifactRepositories() != null )
@@ -142,20 +139,22 @@ public class DefaultArchetypeGenerationC
ArchetypeConfiguration archetypeConfiguration;
if ( archetypeArtifactManager.isFileSetArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
- archetypeRepository, localRepository, repositories ) )
+ archetypeRepository, localRepository, repositories ) )
{
- org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager
- .getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
- archetypeRepository, localRepository, repositories );
+ org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor =
+ archetypeArtifactManager.getFileSetArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(),
+ ad.getVersion(), archetypeRepository,
+ localRepository, repositories );
archetypeConfiguration = archetypeFactory.createArchetypeConfiguration( archetypeDescriptor, properties );
}
else if ( archetypeArtifactManager.isOldArchetype( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(),
- archetypeRepository, localRepository, repositories ) )
+ archetypeRepository, localRepository, repositories ) )
{
- org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager
- .getOldArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository,
- localRepository, repositories );
+ org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor =
+ archetypeArtifactManager.getOldArchetypeDescriptor( ad.getGroupId(), ad.getArtifactId(),
+ ad.getVersion(), archetypeRepository,
+ localRepository, repositories );
archetypeConfiguration = archetypeFactory.createArchetypeConfiguration( archetypeDescriptor, properties );
}
@@ -174,49 +173,62 @@ public class DefaultArchetypeGenerationC
getLogger().debug( "Required properties before content sort: " + propertiesRequired );
Collections.sort( propertiesRequired, new RequiredPropertyComparator( archetypeConfiguration ) );
getLogger().debug( "Required properties after content sort: " + propertiesRequired );
- Iterator requiredProperties = propertiesRequired.iterator();
+
if ( !archetypeConfiguration.isConfigured() )
{
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = propertiesRequired.iterator(); requiredProperties.hasNext(); )
{
String requiredProperty = (String) requiredProperties.next();
if ( !archetypeConfiguration.isConfigured( requiredProperty ) )
{
- if ( "package".equals(requiredProperty) )
+ if ( "package".equals( requiredProperty ) )
{
// if the asked property is 'package', then
// use its default and if not defined,
// use the 'groupId' property value.
String packageDefault = archetypeConfiguration.getDefaultValue( requiredProperty );
- packageDefault = ( null == packageDefault || "".equals( packageDefault ) ) ?
- archetypeConfiguration.getProperty( "groupId" ) :
- archetypeConfiguration.getDefaultValue( requiredProperty );
-
- archetypeConfiguration.setProperty( requiredProperty,
- archetypeGenerationQueryer.getPropertyValue( requiredProperty,
- getTransitiveDefaultValue(packageDefault, archetypeConfiguration) ) );
+ packageDefault =
+ ( null == packageDefault || "".equals( packageDefault ) ) ? archetypeConfiguration.getProperty( "groupId" )
+ : archetypeConfiguration.getDefaultValue( requiredProperty );
+
+ archetypeConfiguration.setProperty(
+ requiredProperty,
+ archetypeGenerationQueryer.getPropertyValue(
+ requiredProperty,
+ getTransitiveDefaultValue(
+ packageDefault,
+ archetypeConfiguration ) ) );
}
else
{
- archetypeConfiguration.setProperty( requiredProperty,
- archetypeGenerationQueryer.getPropertyValue( requiredProperty,
- getTransitiveDefaultValue( archetypeConfiguration.getDefaultValue( requiredProperty ), archetypeConfiguration ) ) );
+ archetypeConfiguration.setProperty(
+ requiredProperty,
+ archetypeGenerationQueryer.getPropertyValue(
+ requiredProperty,
+ getTransitiveDefaultValue(
+ archetypeConfiguration.getDefaultValue( requiredProperty ),
+ archetypeConfiguration ) ) );
}
}
else
{
- getLogger().info( "Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty( requiredProperty) );
+ getLogger().info(
+ "Using property: " + requiredProperty + " = "
+ + archetypeConfiguration.getProperty( requiredProperty ) );
}
}
}
else
{
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = propertiesRequired.iterator(); requiredProperties.hasNext(); )
{
String requiredProperty = (String) requiredProperties.next();
- getLogger().info( "Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty( requiredProperty) );
+
+ getLogger().info(
+ "Using property: " + requiredProperty + " = "
+ + archetypeConfiguration.getProperty( requiredProperty ) );
}
}
@@ -242,9 +254,8 @@ public class DefaultArchetypeGenerationC
{
if ( !archetypeConfiguration.isConfigured() )
{
- Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
-
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+ requiredProperties.hasNext(); )
{
String requiredProperty = (String) requiredProperties.next();
@@ -252,7 +263,7 @@ public class DefaultArchetypeGenerationC
&& ( archetypeConfiguration.getDefaultValue( requiredProperty ) != null ) )
{
archetypeConfiguration.setProperty( requiredProperty,
- archetypeConfiguration.getDefaultValue( requiredProperty ) );
+ archetypeConfiguration.getDefaultValue( requiredProperty ) );
}
}
@@ -269,18 +280,20 @@ public class DefaultArchetypeGenerationC
exceptionMessage.append( " is not configured" );
List missingProperties = new ArrayList( 0 );
- requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+ requiredProperties.hasNext(); )
{
- String requiredProperty = (String)requiredProperties.next();
+ String requiredProperty = (String) requiredProperties.next();
+
if ( !archetypeConfiguration.isConfigured( requiredProperty ) )
{
exceptionMessage.append( "\n\tProperty " );
exceptionMessage.append( requiredProperty );
missingProperties.add( requiredProperty );
exceptionMessage.append( " is missing." );
- getLogger().warn( "Property " + requiredProperty
- + " is missing. Add -D" + requiredProperty + "=someValue" );
+ getLogger().warn(
+ "Property " + requiredProperty + " is missing. Add -D" + requiredProperty
+ + "=someValue" );
}
}
@@ -309,10 +322,11 @@ public class DefaultArchetypeGenerationC
{
return null;
}
- Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
- while ( requiredProperties.hasNext() )
+ for ( Iterator requiredProperties = archetypeConfiguration.getRequiredProperties().iterator();
+ requiredProperties.hasNext(); )
{
String property = (String) requiredProperties.next();
+
if ( result.indexOf( "${" + property + "}" ) >= 0 )
{
result = StringUtils.replace( result, "${" + property + "}",
@@ -327,10 +341,10 @@ public class DefaultArchetypeGenerationC
{
getLogger().debug( "Restoring command line properties" );
- Iterator properties = archetypeConfiguration.getRequiredProperties().iterator();
- while ( properties.hasNext() )
+ for ( Iterator properties = archetypeConfiguration.getRequiredProperties().iterator(); properties.hasNext(); )
{
String property = (String) properties.next();
+
if ( executionProperties.containsKey( property ) )
{
archetypeConfiguration.setProperty( property, executionProperties.getProperty( property ) );
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java?rev=925767&r1=925766&r2=925767&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeGenerationQueryer.java Sun Mar 21 13:43:08 2010
@@ -35,17 +35,15 @@ public class DefaultArchetypeGenerationQ
private Prompter prompter;
public boolean confirmConfiguration( ArchetypeConfiguration archetypeConfiguration )
- throws
- PrompterException
+ throws PrompterException
{
String query = "Confirm properties configuration:\n";
- Iterator requiredPropertiesIter =
- archetypeConfiguration.getRequiredProperties().iterator();
-
- while ( requiredPropertiesIter.hasNext() )
+ for ( Iterator requiredPropertiesIter = archetypeConfiguration.getRequiredProperties().iterator();
+ requiredPropertiesIter.hasNext(); )
{
String property = (String) requiredPropertiesIter.next();
+
query += property + ": " + archetypeConfiguration.getProperty( property ) + "\n";
}
@@ -54,10 +52,8 @@ public class DefaultArchetypeGenerationQ
return "Y".equalsIgnoreCase( answer );
}
- public String getPropertyValue( String requiredProperty,
- String defaultValue )
- throws
- PrompterException
+ public String getPropertyValue( String requiredProperty, String defaultValue )
+ throws PrompterException
{
String query = "Define value for property '" + requiredProperty + "': ";
String answer;