
io.fabric8.maven.plugin.combine.JsonCombiner Maven / Gradle / Ivy
/*
* Copyright 2016 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.maven.plugin.combine;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
/**
* @author roland
* @since 31/03/16
*/
public class JsonCombiner {
private final Log log;
private MavenProject project;
public JsonCombiner(Log log, MavenProject project) {
this.project = project;
this.log = log;
}
/*
public void combineDependentJsonFiles(File json, String templateName) throws MojoExecutionException {
try {
Set jsonFiles = new LinkedHashSet<>();
Set dependencyArtifacts = project.getDependencyArtifacts();
for (Artifact artifact : dependencyArtifacts) {
String classifier = artifact.getClassifier();
String type = artifact.getType();
File file = artifact.getFile();
if (MavenUtils.isKubernetesJsonArtifact(classifier, type)) {
if (file != null) {
System.out.println("Found kubernetes JSON dependency: " + artifact);
jsonFiles.add(file);
} else {
Set artifacts = resolveArtifacts(artifact);
for (Artifact resolvedArtifact : artifacts) {
classifier = resolvedArtifact.getClassifier();
type = resolvedArtifact.getType();
file = resolvedArtifact.getFile();
if (MavenUtils.isKubernetesJsonArtifact(classifier, type) && file != null) {
System.out.println("Resolved kubernetes JSON dependency: " + artifact);
jsonFiles.add(file);
}
}
}
}
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy