Skip to content

Commit b0942a6

Browse files
jvv-trackunitslachiewicz
authored andcommitted
[MDEP-739] Dependency Plugin go-offline doesn't respect artifact classifier
Closes #133
1 parent 205c1a7 commit b0942a6

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:go-offline
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<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">
23+
<modelVersion>4.0.0</modelVersion>
24+
<groupId>org.apache.maven.plugins.dependency</groupId>
25+
<artifactId>mdep-739-go-offline-respect-classifiers</artifactId>
26+
<version>1.0.0-SNAPSHOT</version>
27+
<description>Test that dependency:go-offline respects classifiers on artifacts</description>
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.cloud</groupId>
31+
<artifactId>spring-cloud-stream</artifactId>
32+
<scope>test</scope>
33+
<type>test-jar</type>
34+
<classifier>test-binder</classifier>
35+
<version>3.1.2</version>
36+
</dependency>
37+
</dependencies>
38+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
File file = new File( basedir, "build.log" );
21+
assert file.exists();
22+
23+
String buildLog = file.getText( "UTF-8" );
24+
assert buildLog.contains( 'Resolved dependency: spring-cloud-stream-3.1.2-test-binder.jar' );
25+
26+
return true;

src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ private DependableCoordinate createDependendableCoordinateFromArtifact( final Ar
187187
result.setArtifactId( artifact.getArtifactId() );
188188
result.setVersion( artifact.getVersion() );
189189
result.setType( artifact.getType() );
190+
result.setClassifier( artifact.getClassifier() );
190191

191192
return result;
192193
}
@@ -198,6 +199,7 @@ private DependableCoordinate createDependendableCoordinateFromDependency( final
198199
result.setArtifactId( dependency.getArtifactId() );
199200
result.setVersion( dependency.getVersion() );
200201
result.setType( dependency.getType() );
202+
result.setClassifier( dependency.getClassifier() );
201203

202204
return result;
203205
}

0 commit comments

Comments
 (0)