in src/main/java/org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java [58:120]
public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
throws IOException {
Xpp3Dom newDom;
try {
BufferedInputStream bis = new BufferedInputStream(is) {
@Override
public void close() throws IOException {
// leave ZIP open
}
};
Reader reader = ReaderFactory.newXmlReader(bis);
newDom = Xpp3DomBuilder.build(reader);
} catch (Exception e) {
throw new IOException("Error parsing plugin.xml in " + is, e);
}
// Only try to merge in mojos if there are some elements in the plugin
if (newDom.getChild("mojos") == null) {
return;
}
if (time > this.time) {
this.time = time;
}
for (Xpp3Dom mojo : newDom.getChild("mojos").getChildren("mojo")) {
String impl = getValue(mojo, "implementation");
impl = getRelocatedClass(impl, relocators);
setValue(mojo, "implementation", impl);
Xpp3Dom parameters = mojo.getChild("parameters");
if (parameters != null) {
for (Xpp3Dom parameter : parameters.getChildren()) {
String type = getValue(parameter, "type");
type = getRelocatedClass(type, relocators);
setValue(parameter, "type", type);
}
}
Xpp3Dom configuration = mojo.getChild("configuration");
if (configuration != null) {
for (Xpp3Dom configurationEntry : configuration.getChildren()) {
String implementation = getAttribute(configurationEntry, "implementation");
implementation = getRelocatedClass(implementation, relocators);
setAttribute(configurationEntry, "implementation", implementation);
}
}
Xpp3Dom requirements = mojo.getChild("requirements");
if (requirements != null && requirements.getChildCount() > 0) {
for (Xpp3Dom requirement : requirements.getChildren()) {
String requiredRole = getValue(requirement, "role");
requiredRole = getRelocatedClass(requiredRole, relocators);
setValue(requirement, "role", requiredRole);
}
}
mojos.add(mojo);
}
}