Skip to content

Commit

Permalink
Fixes #10. Copy plugin configuration to all executions without a conf…
Browse files Browse the repository at this point in the history
…iguration
  • Loading branch information
rzymek committed Sep 15, 2013
1 parent d02f22d commit 5962245
Showing 1 changed file with 13 additions and 3 deletions.
@@ -1,12 +1,15 @@
package it.session.maven.plugin;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.merge.ModelMerger;

import java.util.HashMap;
import java.util.Map;

/**
* TilesModelMerger by-passes the invocation to ModelMerger.merge() by adding the merge of Plugin configuration.
*/
Expand All @@ -27,6 +30,13 @@ public void merge( Model target, Model source, boolean sourceDominant, Map<?, ?>
for(Plugin sourcePlugin : source.getBuild().getPlugins()) {
Plugin targetPlugin = target.getBuild().getPluginsAsMap().get(sourcePlugin.getKey());
super.mergePlugin(targetPlugin, sourcePlugin, sourceDominant, context);
Set<Entry<String, PluginExecution>> entrySet = targetPlugin.getExecutionsAsMap().entrySet();
for (Entry<String, PluginExecution> entry : entrySet) {
PluginExecution execution = entry.getValue();
if (execution.getConfiguration() == null) {
execution.setConfiguration(sourcePlugin.getConfiguration());
}
}
}
}
}
Expand Down

0 comments on commit 5962245

Please sign in to comment.