Issue 8 - Unnecessry code removal

The TilesModelMerger is not providing anything
over what the base class already does. Unless
specific bugs or changed behaviour are discovered in
the base I see no point in keeping the code.

The pom is also not the way we do things. License
and Developers moved to plugin itself.

Change-Id: Ibe6fbba2b239ef17d86dab223c1a2c2a129dca76
This commit is contained in:
Richard Vowles
2014-07-13 17:33:45 +12:00
committed by Mark Derricutt
parent 0c7d7cff4a
commit 40a6eb58ba
3 changed files with 32 additions and 44 deletions

32
pom.xml
View File

@@ -20,9 +20,39 @@
<version>1.1-SNAPSHOT</version>
<name>Maven Tiles Plugin</name>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>talios</id>
<email>mark@talios.com</email>
<name>Mark Derricutt</name>
</developer>
<developer>
<id>richard</id>
<email>richard@bluetrainsoftware.com</email>
<name>Richard Vowles</name>
</developer>
<!-- from original fork -->
<developer>
<id>maoo</id>
<email>maurizio@session.it</email>
</developer>
<developer>
<id>tony.franca</id>
<email>tonylampada@gmail.com</email>
</developer>
</developers>
<properties>
<mavenVersion>3.0.4</mavenVersion>
<mavenVersion>3.2.1</mavenVersion>
<asciidoclet.version>0.1.4</asciidoclet.version>
</properties>

View File

@@ -69,7 +69,7 @@ public class TilesMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
protected static final String TILE_PROPERTY_PREFIX = "tile.";
protected final MavenXpp3Reader reader = new MavenXpp3Reader();
protected final ModelMerger modelMerger = new TilesModelMerger();
protected final ModelMerger modelMerger = new ModelMerger();
@Requirement
protected Logger logger;

View File

@@ -1,42 +0,0 @@
package it.session.maven.plugin;
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;
import java.util.Map.Entry;
import java.util.Set;
/**
* TilesModelMerger by-passes the invocation to ModelMerger.merge() by adding the merge of Plugin configuration.
*/
public class TilesModelMerger extends ModelMerger {
public void merge(Model target, Model source, boolean sourceDominant, Map<?, ?> hints) {
Map<Object, Object> context = new HashMap<Object, Object>();
if (hints != null) {
context.putAll(hints);
}
super.merge(target, source, sourceDominant, hints);
if (source.getBuild() != null) {
super.merge(target, source, sourceDominant, context);
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());
}
}
}
}
}
}