From 11cb603da9d3da813c0a34a9e2532cc2c85f940b Mon Sep 17 00:00:00 2001 From: sseifert Date: Sat, 19 Jan 2019 00:35:31 +0100 Subject: [PATCH] ARCHETYPE-536 Update Groovy dependency and enable Groovy Grape in archetype-post-generate.groovy script (by including Ivy dependency) --- archetype-common/pom.xml | 15 +++++- .../archetype/pom.xml | 45 +++++++++++++++++ .../META-INF/archetype-post-generate.groovy | 30 +++++++++++ .../META-INF/maven/archetype-metadata.xml | 31 ++++++++++++ .../resources/archetype-resources/pom.xml | 31 ++++++++++++ .../invoker.properties | 23 +++++++++ .../ARCHETYPE-536_groovy-grape/pom.xml | 50 +++++++++++++++++++ .../project.properties | 27 ++++++++++ .../ARCHETYPE-536_groovy-grape/verify.groovy | 25 ++++++++++ 9 files changed, 276 insertions(+), 1 deletion(-) create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/archetype-post-generate.groovy create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/invoker.properties create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/project.properties create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/verify.groovy diff --git a/archetype-common/pom.xml b/archetype-common/pom.xml index 163676b53..078024e8a 100644 --- a/archetype-common/pom.xml +++ b/archetype-common/pom.xml @@ -53,7 +53,20 @@ org.codehaus.groovy groovy - 1.8.3 + 2.4.16 + compile + + + org.apache.ivy + ivy + 2.4.0 + runtime + + + * + * + + net.sourceforge.jchardet diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/pom.xml new file mode 100644 index 000000000..33497a69f --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + + org.apache.maven.plugins.archetype.its + archetype536-parent + 1.0-SNAPSHOT + + archetype536-archetype + maven-archetype + + + + + org.apache.maven.plugins + maven-archetype-plugin + + src/main/resources + + + + + + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/archetype-post-generate.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/archetype-post-generate.groovy new file mode 100644 index 000000000..138dcc4f5 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/archetype-post-generate.groovy @@ -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. + */ + +def rootDir = new File(request.getOutputDirectory() + "/" + request.getArtifactId()) +def textFile = new File(rootDir, "test.txt") + +// use commons-code as example to include an external library +@Grab(group='commons-codec', module='commons-codec', version='1.11') +def test = "Test Text" +def textHexString = org.apache.commons.codec.binary.Hex.encodeHexString(test.getBytes("UTF-8")) + +textFile.newWriter("UTF-8").withWriter { w -> + w << textHexString +} diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 000000000..b7b97a4b7 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 000000000..4f81a0f7a --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,31 @@ + + + + + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + pom + + \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/invoker.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/invoker.properties new file mode 100644 index 000000000..aaa45c6c7 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/invoker.properties @@ -0,0 +1,23 @@ +# 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. + +invoker.goals.1 = install +invoker.project.1 = archetype + +invoker.goals.2 = org.apache.maven.plugins:maven-archetype-plugin:${project.version}:generate +invoker.systemPropertiesFile = project.properties + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/pom.xml new file mode 100644 index 000000000..118b2dd60 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + org.apache.maven.plugins.archetype.its + archetype536-parent + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.archetype + archetype-packaging + @project.version@ + + + + + + + org.apache.maven.plugins + maven-archetype-plugin + @project.version@ + + + + + + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/project.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/project.properties new file mode 100644 index 000000000..64404f57b --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/project.properties @@ -0,0 +1,27 @@ +# 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. + +archetypeGroupId=org.apache.maven.plugins.archetype.its +archetypeArtifactId=archetype536-archetype +archetypeVersion=1.0-SNAPSHOT + +groupId=com.company +artifactId=myArtifactId +version=1.0-SNAPSHOT +package=com.company.project + +projectName=myName diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/verify.groovy new file mode 100644 index 000000000..6473181ee --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/verify.groovy @@ -0,0 +1,25 @@ +/* + * 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. + */ + +def textFile = new File(basedir, "myArtifactId/test.txt") + +assert textFile.exists() + +def hexString = textFile.getText("UTF-8") +assert hexString == "546573742054657874"