This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch MDEP-739 in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit b0942a6502d222ad32e54def23df893aa32cf436 Author: Jonas van Vliet <[email protected]> AuthorDate: Mon May 10 12:29:48 2021 +0200 [MDEP-739] Dependency Plugin go-offline doesn't respect artifact classifier Closes #133 --- .../invoker.properties | 18 ++++++++++ .../pom.xml | 38 ++++++++++++++++++++++ .../verify.groovy | 26 +++++++++++++++ .../dependency/resolvers/GoOfflineMojo.java | 2 ++ 4 files changed, 84 insertions(+) diff --git a/src/it/projects/mdep-739-go-offline-respect-classifiers/invoker.properties b/src/it/projects/mdep-739-go-offline-respect-classifiers/invoker.properties new file mode 100644 index 0000000..e596121 --- /dev/null +++ b/src/it/projects/mdep-739-go-offline-respect-classifiers/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 = ${project.groupId}:${project.artifactId}:${project.version}:go-offline diff --git a/src/it/projects/mdep-739-go-offline-respect-classifiers/pom.xml b/src/it/projects/mdep-739-go-offline-respect-classifiers/pom.xml new file mode 100644 index 0000000..5c27c42 --- /dev/null +++ b/src/it/projects/mdep-739-go-offline-respect-classifiers/pom.xml @@ -0,0 +1,38 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.dependency</groupId> + <artifactId>mdep-739-go-offline-respect-classifiers</artifactId> + <version>1.0.0-SNAPSHOT</version> + <description>Test that dependency:go-offline respects classifiers on artifacts</description> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-stream</artifactId> + <scope>test</scope> + <type>test-jar</type> + <classifier>test-binder</classifier> + <version>3.1.2</version> + </dependency> + </dependencies> +</project> diff --git a/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy b/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy new file mode 100644 index 0000000..fcc7dc0 --- /dev/null +++ b/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy @@ -0,0 +1,26 @@ +/* + * 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. + */ + +File file = new File( basedir, "build.log" ); +assert file.exists(); + +String buildLog = file.getText( "UTF-8" ); +assert buildLog.contains( 'Resolved dependency: spring-cloud-stream-3.1.2-test-binder.jar' ); + +return true; diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java index e0e8b1f..4145b45 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java @@ -187,6 +187,7 @@ public class GoOfflineMojo result.setArtifactId( artifact.getArtifactId() ); result.setVersion( artifact.getVersion() ); result.setType( artifact.getType() ); + result.setClassifier( artifact.getClassifier() ); return result; } @@ -198,6 +199,7 @@ public class GoOfflineMojo result.setArtifactId( dependency.getArtifactId() ); result.setVersion( dependency.getVersion() ); result.setType( dependency.getType() ); + result.setClassifier( dependency.getClassifier() ); return result; }
