Search in sources :

Example 1 with ModuleIdentifierValidator

use of org.apache.maven.plugins.ear.util.ModuleIdentifierValidator in project maven-plugins by apache.

the class ModuleIdentifierValidatorTest method before.

@Before
public void before() {
    this.earModules = new ArrayList<EarModule>();
    this.miv = new ModuleIdentifierValidator(this.earModules);
}
Also used : EarModule(org.apache.maven.plugins.ear.EarModule) ModuleIdentifierValidator(org.apache.maven.plugins.ear.util.ModuleIdentifierValidator) Before(org.junit.Before)

Example 2 with ModuleIdentifierValidator

use of org.apache.maven.plugins.ear.util.ModuleIdentifierValidator in project maven-plugins by apache.

the class EarMojo method checkModuleUniqueness.

private void checkModuleUniqueness() throws MojoExecutionException {
    ModuleIdentifierValidator miv = new ModuleIdentifierValidator(getModules());
    miv.checkForDuplicateArtifacts();
    if (miv.existDuplicateArtifacts()) {
        Map<String, List<EarModule>> duplicateArtifacts = miv.getDuplicateArtifacts();
        for (Entry<String, List<EarModule>> entry : duplicateArtifacts.entrySet()) {
            getLog().warn("The artifactId " + entry.getKey() + " exists more than once in the modules list.");
            for (EarModule earModule : entry.getValue()) {
                getLog().warn(" --> " + earModule.getArtifact().getId() + " (" + earModule.getType() + ")");
            }
        }
        getLog().warn("HINT: This can be simply solved by using the <fileNameMapping>full</fileNameMapping>");
        if (duplicateArtifactsBreakTheBuild) {
            // CHECKSTYLE_OFF: LineLength
            throw new MojoExecutionException("The build contains duplicate artifacts which result in unpredictable ear content.");
        // CHECKSTYLE_ON: LineLength
        }
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ModuleIdentifierValidator(org.apache.maven.plugins.ear.util.ModuleIdentifierValidator) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ModuleIdentifierValidator (org.apache.maven.plugins.ear.util.ModuleIdentifierValidator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 EarModule (org.apache.maven.plugins.ear.EarModule)1 Before (org.junit.Before)1