-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #74: Add display-extension-updates
- Loading branch information
Showing
11 changed files
with
718 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
versions-common/src/main/java/org/codehaus/mojo/versions/utils/ExtensionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.codehaus.mojo.versions.utils; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
import org.apache.maven.model.Dependency; | ||
import org.apache.maven.model.Extension; | ||
import org.apache.maven.model.InputLocation; | ||
|
||
import static java.util.Optional.empty; | ||
import static java.util.Optional.ofNullable; | ||
|
||
/** | ||
* Builder class for {@linkplain Extension} | ||
*/ | ||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") | ||
public class ExtensionBuilder { | ||
private Optional<String> groupId = empty(); | ||
private Optional<String> artifactId = empty(); | ||
private Optional<String> version = empty(); | ||
private Map<Object, InputLocation> locations = new HashMap<>(); | ||
|
||
private ExtensionBuilder() {} | ||
|
||
/** | ||
* Passes groupId to the builder | ||
* @param groupId given groupId | ||
* @return builder instance | ||
*/ | ||
public ExtensionBuilder withGroupId(String groupId) { | ||
this.groupId = ofNullable(groupId); | ||
return this; | ||
} | ||
|
||
/** | ||
* Passes artifactId to the builder | ||
* @param artifactId given artifactId | ||
* @return builder instance | ||
*/ | ||
public ExtensionBuilder withArtifactId(String artifactId) { | ||
this.artifactId = ofNullable(artifactId); | ||
return this; | ||
} | ||
|
||
/** | ||
* Passes version to the builder | ||
* @param version given version | ||
* @return builder instance | ||
*/ | ||
public ExtensionBuilder withVersion(String version) { | ||
this.version = ofNullable(version); | ||
return this; | ||
} | ||
|
||
/** | ||
* Passes type to the builder | ||
* @param key location key | ||
* @param location input location | ||
* @return builder instance | ||
*/ | ||
public ExtensionBuilder withLocation(Object key, InputLocation location) { | ||
this.locations.put(key, location); | ||
return this; | ||
} | ||
|
||
/** | ||
* Creates a new instance of the builder | ||
* @return new instance of the builder | ||
*/ | ||
public static ExtensionBuilder newBuilder() { | ||
return new ExtensionBuilder(); | ||
} | ||
|
||
/** | ||
* Builds the {@linkplain Dependency} instance | ||
* @return {@linkplain Dependency} instance | ||
*/ | ||
public Extension build() { | ||
Extension inst = new Extension(); | ||
groupId.ifPresent(inst::setGroupId); | ||
artifactId.ifPresent(inst::setArtifactId); | ||
version.ifPresent(inst::setVersion); | ||
locations.forEach(inst::setLocation); | ||
return inst; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
versions-maven-plugin/src/it/it-display-extension-updates-001/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
invoker.goals.1 = ${project.groupId}:${project.artifactId}:${project.version}:display-extension-updates | ||
invoker.mavenOpts.1 = -Dversions.outputFile=./output1.txt -DoutputEncoding=UTF-8 | ||
|
||
invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:display-extension-updates | ||
invoker.mavenOpts.2 = -Dversions.outputFile=./output2.txt -DoutputEncoding=UTF-8 -DextensionExcludes=localhost | ||
|
||
invoker.goals.3 = ${project.groupId}:${project.artifactId}:${project.version}:display-extension-updates | ||
invoker.mavenOpts.3 = -Dversions.outputFile=./output3.txt -DoutputEncoding=UTF-8 -DextensionIncludes=localhost -DextensionExcludes=localhost:dummy-api |
Oops, something went wrong.