This is an automated email from the ASF dual-hosted git repository. olamy pushed a commit to branch MRRESOURCES-121-dependencies-ignored in repository https://gitbox.apache.org/repos/asf/maven-remote-resources-plugin.git
commit f98fc0f4e6f39645e66888fd0dcba28524894de3 Author: Olivier Lamy <ol...@apache.org> AuthorDate: Sun Aug 7 17:56:28 2022 +1000 [MRRESOURCES-121] add IT test Signed-off-by: Olivier Lamy <ol...@apache.org> --- .../invoker.properties | 18 +++++ .../MRRESOURCES-121-dependencies-ignored/pom.xml | 75 ++++++++++++++++++++ .../src/main/java/org/apache/maven/MyMojo.java | 81 ++++++++++++++++++++++ .../verify.groovy | 35 ++++++++++ 4 files changed, 209 insertions(+) diff --git a/src/it/MRRESOURCES-121-dependencies-ignored/invoker.properties b/src/it/MRRESOURCES-121-dependencies-ignored/invoker.properties new file mode 100644 index 0000000..0097f00 --- /dev/null +++ b/src/it/MRRESOURCES-121-dependencies-ignored/invoker.properties @@ -0,0 +1,18 @@ +# 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 = generate-resources diff --git a/src/it/MRRESOURCES-121-dependencies-ignored/pom.xml b/src/it/MRRESOURCES-121-dependencies-ignored/pom.xml new file mode 100644 index 0000000..0d500f7 --- /dev/null +++ b/src/it/MRRESOURCES-121-dependencies-ignored/pom.xml @@ -0,0 +1,75 @@ +<?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. +--> + +<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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven</groupId> + <artifactId>MRRESOURCES-121-dependencies-ignored</artifactId> + <version>1.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <inceptionYear>2001</inceptionYear> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-cipher</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-api</artifactId> + <version>1.6.3</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-remote-resources-plugin</artifactId> + <version>@project.version@</version> +<!-- <version>1.7.0</version>--> + <executions> + <execution> + <id>process-resource-bundles</id> + <goals> + <goal>process</goal> + </goals> + <configuration> + <resourceBundles> + <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle> + </resourceBundles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/it/MRRESOURCES-121-dependencies-ignored/src/main/java/org/apache/maven/MyMojo.java b/src/it/MRRESOURCES-121-dependencies-ignored/src/main/java/org/apache/maven/MyMojo.java new file mode 100644 index 0000000..bc7e823 --- /dev/null +++ b/src/it/MRRESOURCES-121-dependencies-ignored/src/main/java/org/apache/maven/MyMojo.java @@ -0,0 +1,81 @@ +package org.apache.maven; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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 org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * Goal which touches a timestamp file. + * + * @goal touch + * + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter expression="${project.build.directory}" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/src/it/MRRESOURCES-121-dependencies-ignored/verify.groovy b/src/it/MRRESOURCES-121-dependencies-ignored/verify.groovy new file mode 100644 index 0000000..6a542f1 --- /dev/null +++ b/src/it/MRRESOURCES-121-dependencies-ignored/verify.groovy @@ -0,0 +1,35 @@ + +/* + * 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 dependencies = new File( basedir, 'target/maven-shared-archive-resources/META-INF/DEPENDENCIES' ) +assert dependencies.exists() +content = dependencies.text + +assert 2 == content.count( 'License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)' ) +assert 1 == content.count( 'License: Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)' ) +assert 1 == content.count( 'License: Apache License, Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)' ) + +assert 1 == content.count( 'From: \'Apache Software Foundation\' (http://www.apache.org/)' ) +assert 1 == content.count( 'Maven Plugin API (http://maven.apache.org/maven2/maven-plugin-api/) org.apache.maven:maven-plugin-api:jar:2.0' ) + +assert 1 == content.count( 'From: \'Codehaus Plexus\' (https://codehaus-plexus.github.io/)' ) +assert 1 == content.count( 'Plexus Cipher: encryption/decryption Component (https://codehaus-plexus.github.io/plexus-cipher/) org.codehaus.plexus:plexus-cipher:jar:2.0' ) + +assert 1 == content.count( 'From: \'The Apache Software Foundation\' (https://www.apache.org/)' ) +assert 1 == content.count( 'Maven Artifact Resolver API (https://maven.apache.org/resolver/maven-resolver-api/) org.apache.maven.resolver:maven-resolver-api:jar:1.6.3' )