Repository: maven-archetype Updated Branches: refs/heads/ARCHETYPE-514 [created] a02e9922c
Move ITS to plugin Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/afdf0a2c Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/afdf0a2c Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/afdf0a2c Branch: refs/heads/ARCHETYPE-514 Commit: afdf0a2c4ff57632044099b852b1d116531f81c2 Parents: 44e7ed6 Author: rfscholte <rfscho...@apache.org> Authored: Mon Jan 23 20:46:47 2017 +0100 Committer: rfscholte <rfscho...@apache.org> Committed: Mon Jan 23 20:46:47 2017 +0100 ---------------------------------------------------------------------- .../creator/FilesetArchetypeCreator.java | 88 +++++++------------- archetype-testing/archetype-final/pom.xml | 35 +------- .../archetype.properties | 1 - .../invoker.properties | 1 - .../pom.xml | 30 ------- .../src/main/resources/file.txt | 0 .../src/main/resources/file.xml | 0 .../src/main/resources/toexclude/file.txt | 0 .../src/main/resources/toexclude/file.xml | 0 .../src/main/toexclude/file.txt | 0 .../src/main/toexclude/file.xml | 0 .../src/toexclude/file.txt | 0 .../src/toexclude/file.xml | 0 .../toexclude/file.txt | 0 .../toexclude/file.xml | 0 .../verify.bsh | 46 ---------- .../it/create-from-project/archetype.properties | 1 - .../it/create-from-project/invoker.properties | 1 - .../src/it/create-from-project/pom.xml | 30 ------- .../src/main/java/foo/bar/App.java | 32 ------- .../src/it/create-from-project/verify.bsh | 38 --------- .../archetype-final/src/it/settings.xml | 55 ------------ .../archetype.properties | 1 + .../invoker.properties | 1 + .../pom.xml | 30 +++++++ .../src/main/resources/file.txt | 0 .../src/main/resources/file.xml | 0 .../src/main/resources/toexclude/file.txt | 0 .../src/main/resources/toexclude/file.xml | 0 .../src/main/toexclude/file.txt | 0 .../src/main/toexclude/file.xml | 0 .../src/toexclude/file.txt | 0 .../src/toexclude/file.xml | 0 .../toexclude/file.txt | 0 .../toexclude/file.xml | 0 .../verify.bsh | 46 ++++++++++ .../it/create-from-project/archetype.properties | 1 + .../it/create-from-project/invoker.properties | 1 + .../src/it/create-from-project/pom.xml | 30 +++++++ .../src/main/java/foo/bar/App.java | 32 +++++++ .../src/it/create-from-project/verify.bsh | 38 +++++++++ 41 files changed, 211 insertions(+), 327 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java ---------------------------------------------------------------------- diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java index 22465fd..576d33b 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java @@ -48,7 +48,6 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.shared.invoker.DefaultInvocationRequest; -import org.apache.maven.shared.invoker.DefaultInvoker; import org.apache.maven.shared.invoker.InvocationRequest; import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.invoker.Invoker; @@ -104,6 +103,9 @@ public class FilesetArchetypeCreator @Requirement private MavenProjectBuilder projectBuilder; + + @Requirement + private Invoker invoker; public void createArchetype( ArchetypeCreationRequest request, ArchetypeCreationResult result ) { @@ -216,9 +218,8 @@ public class FilesetArchetypeCreator setParentArtifactId( reverseProperties, configurationProperties.getProperty( Constants.ARTIFACT_ID ) ); - for ( Iterator<String> modules = pom.getModules().iterator(); modules.hasNext(); ) + for ( String moduleId : pom.getModules() ) { - String moduleId = (String) modules.next(); String rootArtifactId = configurationProperties.getProperty( Constants.ARTIFACT_ID ); String moduleIdDirectory = moduleId; @@ -287,8 +288,11 @@ public class FilesetArchetypeCreator InvocationRequest internalRequest = new DefaultInvocationRequest(); internalRequest.setPomFile( archetypePomFile ); internalRequest.setGoals( Collections.singletonList( request.getPostPhase() ) ); + if ( request.getLocalRepository() != null ) + { + internalRequest.setLocalRepositoryDirectory( new File( request.getLocalRepository().getBasedir() ) ); + } - Invoker invoker = new DefaultInvoker(); InvocationResult invokerResult = invoker.execute( internalRequest ); if ( invokerResult.getExitCode() != 0 ) { @@ -541,10 +545,8 @@ public class FilesetArchetypeCreator setParentArtifactId( pomReversedProperties, pomReversedProperties.getProperty( Constants.ARTIFACT_ID ) ); setArtifactId( pomReversedProperties, pom.getArtifactId() ); - for ( Iterator<String> modules = pom.getModules().iterator(); modules.hasNext(); ) + for ( String subModuleId : pom.getModules() ) { - String subModuleId = modules.next(); - String subModuleIdDirectory = subModuleId; if ( subModuleId.indexOf( rootArtifactId ) >= 0 ) @@ -571,10 +573,8 @@ public class FilesetArchetypeCreator { setArtifactId( pomReversedProperties, pom.getArtifactId() ); - for ( Iterator<String> modules = pom.getModules().iterator(); modules.hasNext(); ) + for ( String moduleId : pom.getModules() ) { - String moduleId = modules.next(); - String moduleIdDirectory = moduleId; if ( moduleId.indexOf( rootArtifactId ) >= 0 ) @@ -604,9 +604,9 @@ public class FilesetArchetypeCreator // rewrite Dependencies if ( pom.getDependencies() != null && !pom.getDependencies().isEmpty() ) { - for ( Iterator<Dependency> dependencies = pom.getDependencies().iterator(); dependencies.hasNext(); ) + for ( Dependency dependency : pom.getDependencies() ) { - rewriteDependencyReferences( dependencies.next(), rootArtifactId, groupId ); + rewriteDependencyReferences( dependency, rootArtifactId, groupId ); } } @@ -614,19 +614,18 @@ public class FilesetArchetypeCreator if ( pom.getDependencyManagement() != null && pom.getDependencyManagement().getDependencies() != null && !pom.getDependencyManagement().getDependencies().isEmpty() ) { - for ( Iterator<Dependency> dependencies = pom.getDependencyManagement().getDependencies().iterator(); - dependencies.hasNext(); ) + for ( Dependency dependency : pom.getDependencyManagement().getDependencies() ) { - rewriteDependencyReferences( dependencies.next(), rootArtifactId, groupId ); + rewriteDependencyReferences( dependency, rootArtifactId, groupId ); } } // rewrite Plugins if ( pom.getBuild() != null && pom.getBuild().getPlugins() != null && !pom.getBuild().getPlugins().isEmpty() ) { - for ( Iterator<Plugin> plugins = pom.getBuild().getPlugins().iterator(); plugins.hasNext(); ) + for ( Plugin plugin : pom.getBuild().getPlugins() ) { - rewritePluginReferences( plugins.next(), rootArtifactId, groupId ); + rewritePluginReferences( plugin, rootArtifactId, groupId ); } } @@ -635,27 +634,23 @@ public class FilesetArchetypeCreator && pom.getBuild().getPluginManagement().getPlugins() != null && !pom.getBuild().getPluginManagement().getPlugins().isEmpty() ) { - for ( Iterator<Plugin> plugins = pom.getBuild().getPluginManagement().getPlugins().iterator(); - plugins.hasNext(); ) + for ( Plugin plugin : pom.getBuild().getPluginManagement().getPlugins() ) { - rewritePluginReferences( plugins.next(), rootArtifactId, groupId ); + rewritePluginReferences( plugin, rootArtifactId, groupId ); } } // rewrite Profiles if ( pom.getProfiles() != null ) { - for ( Iterator<Profile> profiles = pom.getProfiles().iterator(); profiles.hasNext(); ) + for ( Profile profile : pom.getProfiles() ) { - Profile profile = profiles.next(); - // rewrite Dependencies if ( profile.getDependencies() != null && !profile.getDependencies().isEmpty() ) { - for ( Iterator<Dependency> dependencies = profile.getDependencies().iterator(); - dependencies.hasNext(); ) + for ( Dependency dependency : profile.getDependencies() ) { - rewriteDependencyReferences( dependencies.next(), rootArtifactId, groupId ); + rewriteDependencyReferences( dependency, rootArtifactId, groupId ); } } @@ -664,10 +659,9 @@ public class FilesetArchetypeCreator && profile.getDependencyManagement().getDependencies() != null && !profile.getDependencyManagement().getDependencies().isEmpty() ) { - for ( Iterator<Dependency> dependencies = - profile.getDependencyManagement().getDependencies().iterator(); dependencies.hasNext(); ) + for ( Dependency dependency : profile.getDependencyManagement().getDependencies() ) { - rewriteDependencyReferences( dependencies.next(), rootArtifactId, groupId ); + rewriteDependencyReferences( dependency, rootArtifactId, groupId ); } } @@ -675,9 +669,9 @@ public class FilesetArchetypeCreator if ( profile.getBuild() != null && profile.getBuild().getPlugins() != null && !profile.getBuild().getPlugins().isEmpty() ) { - for ( Iterator<Plugin> plugins = profile.getBuild().getPlugins().iterator(); plugins.hasNext(); ) + for ( Plugin plugin : profile.getBuild().getPlugins() ) { - rewritePluginReferences( plugins.next(), rootArtifactId, groupId ); + rewritePluginReferences( plugin, rootArtifactId, groupId ); } } @@ -686,10 +680,9 @@ public class FilesetArchetypeCreator && profile.getBuild().getPluginManagement().getPlugins() != null && !profile.getBuild().getPluginManagement().getPlugins().isEmpty() ) { - for ( Iterator<Plugin> plugins = profile.getBuild().getPluginManagement().getPlugins().iterator(); - plugins.hasNext(); ) + for ( Plugin plugin : profile.getBuild().getPluginManagement().getPlugins() ) { - rewritePluginReferences( plugins.next(), rootArtifactId, groupId ); + rewritePluginReferences( plugin, rootArtifactId, groupId ); } } } @@ -1075,10 +1068,8 @@ public class FilesetArchetypeCreator String parentArtifactId = reverseProperties.getProperty( Constants.PARENT_ARTIFACT_ID ); setParentArtifactId( reverseProperties, pom.getArtifactId() ); - for ( Iterator<String> modules = pom.getModules().iterator(); modules.hasNext(); ) + for ( String subModuleId : pom.getModules() ) { - String subModuleId = modules.next(); - String subModuleIdDirectory = subModuleId; if ( subModuleId.indexOf( rootArtifactId ) >= 0 ) { @@ -1365,25 +1356,6 @@ public class FilesetArchetypeCreator } } - private List<String> removePackage( List<String> sources, String packageAsDirectory ) - { - if ( sources == null ) - { - return null; - } - - List<String> unpackagedSources = new ArrayList<String>( sources.size() ); - - for ( String source : sources ) - { - String unpackagedSource = StringUtils.replace( source, packageAsDirectory, "" ); - - unpackagedSources.add( unpackagedSource ); - } - - return unpackagedSources; - } - private Properties getReversedProperties( ArchetypeDescriptor archetypeDescriptor, Properties properties ) { Properties reversedProperties = new Properties(); @@ -1412,9 +1384,9 @@ public class FilesetArchetypeCreator getLogger().debug( "Resolving files for " + pom.getId() + " in " + basedir ); StringBuffer buff = new StringBuffer( "pom.xml*,archetype.properties*,target/**," ); - for ( Iterator<String> modules = pom.getModules().iterator(); modules.hasNext(); ) + for ( String module : pom.getModules() ) { - buff.append( ',' ).append( modules.next() ).append( "/**" ); + buff.append( ',' ).append( module ).append( "/**" ); } for ( String defaultExclude : ListScanner.DEFAULTEXCLUDES ) http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/pom.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/pom.xml b/archetype-testing/archetype-final/pom.xml index cff290d..632aa2a 100644 --- a/archetype-testing/archetype-final/pom.xml +++ b/archetype-testing/archetype-final/pom.xml @@ -113,40 +113,7 @@ <scope>test</scope> </dependency> </dependencies> - <profiles> - <profile> - <id>run-its</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-invoker-plugin</artifactId> - <configuration> - <debug>true</debug> - <projectsDirectory>src/it</projectsDirectory> - <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> - <pomIncludes> - <pomInclude>*</pomInclude> - </pomIncludes> - <preBuildHookScript>setup</preBuildHookScript> - <postBuildHookScript>verify</postBuildHookScript> - <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> - <settingsFile>src/it/settings.xml</settingsFile> - </configuration> - <executions> - <execution> - <id>integration-test</id> - <goals> - <goal>install</goal> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> <plugins> <plugin> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/archetype.properties ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/archetype.properties b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/archetype.properties deleted file mode 100644 index 19f85bb..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/archetype.properties +++ /dev/null @@ -1 +0,0 @@ -excludePatterns=**/toexclude/** \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/invoker.properties ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/invoker.properties b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/invoker.properties deleted file mode 100644 index dac2cd9..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/invoker.properties +++ /dev/null @@ -1 +0,0 @@ -invoker.goals = clean org.apache.maven.plugins:maven-archetype-plugin:${project.version}:create-from-project -Darchetype.properties=archetype.properties http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/pom.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/pom.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/pom.xml deleted file mode 100644 index 7a173a0..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.archetype.its</groupId> - <artifactId>create-from-project</artifactId> - <version>1.0-SNAPSHOT</version> - - <name>archetype:create-from-project It</name> -</project> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.txt b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.xml b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/toexclude/file.xml deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/verify.bsh ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/verify.bsh b/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/verify.bsh deleted file mode 100644 index 1021842..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project-exclude-patterns/verify.bsh +++ /dev/null @@ -1,46 +0,0 @@ - -/* - * 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 archetype = new File( basedir, "target/generated-sources/archetype/src/main/resources/archetype-resources/" ); - -// ARCHETYPE-513 -String[] excluded = new String[] { "/", "src/", "src/main/", "src/main/resources/" }; -for ( String exclude : excluded ) -{ - File app = new File( archetype, exclude + "toexclude" ); - if ( app.exists() ) - { - throw new Exception( app + " folder exists when it should have been excluded." ); - } -} - -String[] included = new String[] { "file.txt", "file.xml" }; -for ( String include : included ) -{ - File app = new File( archetype, "src/main/resources/" + include ); - if ( !app.isFile() ) - { - throw new Exception( app + " file does not exist when it should have been included." ); - } -} - -return true; http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project/archetype.properties ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project/archetype.properties b/archetype-testing/archetype-final/src/it/create-from-project/archetype.properties deleted file mode 100644 index 0aa486a..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project/archetype.properties +++ /dev/null @@ -1 +0,0 @@ -AppName App \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project/invoker.properties ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project/invoker.properties b/archetype-testing/archetype-final/src/it/create-from-project/invoker.properties deleted file mode 100644 index dac2cd9..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project/invoker.properties +++ /dev/null @@ -1 +0,0 @@ -invoker.goals = clean org.apache.maven.plugins:maven-archetype-plugin:${project.version}:create-from-project -Darchetype.properties=archetype.properties http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project/pom.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project/pom.xml b/archetype-testing/archetype-final/src/it/create-from-project/pom.xml deleted file mode 100644 index 7a173a0..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.archetype.its</groupId> - <artifactId>create-from-project</artifactId> - <version>1.0-SNAPSHOT</version> - - <name>archetype:create-from-project It</name> -</project> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project/src/main/java/foo/bar/App.java ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project/src/main/java/foo/bar/App.java b/archetype-testing/archetype-final/src/it/create-from-project/src/main/java/foo/bar/App.java deleted file mode 100644 index 5d59afd..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project/src/main/java/foo/bar/App.java +++ /dev/null @@ -1,32 +0,0 @@ -package foo.bar; - -/* - * 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. - */ - -/** - * Hello world! - * package foo.bar from foo/bar directory - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/create-from-project/verify.bsh ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/create-from-project/verify.bsh b/archetype-testing/archetype-final/src/it/create-from-project/verify.bsh deleted file mode 100644 index 84a5f1e..0000000 --- a/archetype-testing/archetype-final/src/it/create-from-project/verify.bsh +++ /dev/null @@ -1,38 +0,0 @@ - -/* - * 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 archetype = new File( basedir, "target/generated-sources/archetype" ); - -File pom = new File( archetype, "pom.xml" ); -if ( !pom.isFile() ) -{ - throw new Exception( pom + " file is missing or not a file." ); -} - -// ARCHETYPE-462 filter file name with archetype.properties properties -File app = new File( archetype, "src/main/resources/archetype-resources/src/main/java/__AppName__.java" ); -if ( !app.isFile() ) -{ - throw new Exception( app + " file is missing or not a file." ); -} - -return true; http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/archetype-testing/archetype-final/src/it/settings.xml ---------------------------------------------------------------------- diff --git a/archetype-testing/archetype-final/src/it/settings.xml b/archetype-testing/archetype-final/src/it/settings.xml deleted file mode 100644 index c8f77f0..0000000 --- a/archetype-testing/archetype-final/src/it/settings.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> - -<settings> - <profiles> - <profile> - <id>it-repo</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <repositories> - <repository> - <id>local.central</id> - <url>@localRepositoryUrl@</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>local.central</id> - <url>@localRepositoryUrl@</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - </profile> - </profiles> -</settings> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/archetype.properties ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/archetype.properties b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/archetype.properties new file mode 100644 index 0000000..19f85bb --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/archetype.properties @@ -0,0 +1 @@ +excludePatterns=**/toexclude/** \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/invoker.properties ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/invoker.properties b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/invoker.properties new file mode 100644 index 0000000..dac2cd9 --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean org.apache.maven.plugins:maven-archetype-plugin:${project.version}:create-from-project -Darchetype.properties=archetype.properties http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/pom.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/pom.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/pom.xml new file mode 100644 index 0000000..7a173a0 --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/pom.xml @@ -0,0 +1,30 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.archetype.its</groupId> + <artifactId>create-from-project</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>archetype:create-from-project It</name> +</project> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/file.xml new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/resources/toexclude/file.xml new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/main/toexclude/file.xml new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/src/toexclude/file.xml new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.txt ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.txt b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.xml b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/toexclude/file.xml new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/verify.bsh ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/verify.bsh b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/verify.bsh new file mode 100644 index 0000000..1021842 --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project-exclude-patterns/verify.bsh @@ -0,0 +1,46 @@ + +/* + * 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 archetype = new File( basedir, "target/generated-sources/archetype/src/main/resources/archetype-resources/" ); + +// ARCHETYPE-513 +String[] excluded = new String[] { "/", "src/", "src/main/", "src/main/resources/" }; +for ( String exclude : excluded ) +{ + File app = new File( archetype, exclude + "toexclude" ); + if ( app.exists() ) + { + throw new Exception( app + " folder exists when it should have been excluded." ); + } +} + +String[] included = new String[] { "file.txt", "file.xml" }; +for ( String include : included ) +{ + File app = new File( archetype, "src/main/resources/" + include ); + if ( !app.isFile() ) + { + throw new Exception( app + " file does not exist when it should have been included." ); + } +} + +return true; http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project/archetype.properties ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project/archetype.properties b/maven-archetype-plugin/src/it/create-from-project/archetype.properties new file mode 100644 index 0000000..0aa486a --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project/archetype.properties @@ -0,0 +1 @@ +AppName App \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project/invoker.properties ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project/invoker.properties b/maven-archetype-plugin/src/it/create-from-project/invoker.properties new file mode 100644 index 0000000..dac2cd9 --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean org.apache.maven.plugins:maven-archetype-plugin:${project.version}:create-from-project -Darchetype.properties=archetype.properties http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project/pom.xml ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project/pom.xml b/maven-archetype-plugin/src/it/create-from-project/pom.xml new file mode 100644 index 0000000..7a173a0 --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project/pom.xml @@ -0,0 +1,30 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.archetype.its</groupId> + <artifactId>create-from-project</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>archetype:create-from-project It</name> +</project> http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project/src/main/java/foo/bar/App.java ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project/src/main/java/foo/bar/App.java b/maven-archetype-plugin/src/it/create-from-project/src/main/java/foo/bar/App.java new file mode 100644 index 0000000..5d59afd --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project/src/main/java/foo/bar/App.java @@ -0,0 +1,32 @@ +package foo.bar; + +/* + * 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. + */ + +/** + * Hello world! + * package foo.bar from foo/bar directory + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/afdf0a2c/maven-archetype-plugin/src/it/create-from-project/verify.bsh ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/create-from-project/verify.bsh b/maven-archetype-plugin/src/it/create-from-project/verify.bsh new file mode 100644 index 0000000..84a5f1e --- /dev/null +++ b/maven-archetype-plugin/src/it/create-from-project/verify.bsh @@ -0,0 +1,38 @@ + +/* + * 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 archetype = new File( basedir, "target/generated-sources/archetype" ); + +File pom = new File( archetype, "pom.xml" ); +if ( !pom.isFile() ) +{ + throw new Exception( pom + " file is missing or not a file." ); +} + +// ARCHETYPE-462 filter file name with archetype.properties properties +File app = new File( archetype, "src/main/resources/archetype-resources/src/main/java/__AppName__.java" ); +if ( !app.isFile() ) +{ + throw new Exception( app + " file is missing or not a file." ); +} + +return true;