Repository: maven-archetype Updated Branches: refs/heads/master 44e7ed632 -> 741f432b8
http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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/741f432b/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;