1

I am using the Maven Checksum Plugin, and I am having problems getting it to execute after the war has been built. Here's my configuration in my superpom under the section:

<build>
    ...
    <pluginManagement>
        <plugins>
            <plugin>
                ...
            </plugin>
            <plugin>
                <groupId>net.ju-n.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.3-SNAPSHOT</version>
                <executions>
                    <execution>
                        <id>generate-artifact-checksum</id>
                        <phase>package</phase>
                        <goals>
                            <goal>files</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <fileSets>
                        <fileSet>
                            <directory>${project.build.directory}/artifacts</directory>
                        </fileSet>
                    </fileSets>
                </configuration>
            </plugin>
            <plugin>
                ...
            </plugin>
        </plugins>
    </pluginManagement>
</build>

When I run mvn package, the plugin isn't executed. Not there's an error, but just doesn't execute. Nothing is printed out during the build process. The war is processed, the build is declared successful, and the plugin doesn't execute.

I've tried removing the <phase> entities and run mvn verify because according to the documentation on the plugin, the checksum:files goal is automatically bound to the verify phase. Still no execution.

However, the plugin does work if I run:

$ mvn checksum:files

What am I missing in my configuration?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
David W.
  • 105,218
  • 39
  • 216
  • 337
  • In your superpom, is this code under `pluginManagement` section or just `plugins`? – Tunaki Aug 13 '15 at 17:05
  • Well, `` is under `` which itself is under ``. The rest of my plugin configurations are also there too, and they all work. I've updated my question to reflect a bit more of this hierarchy. In some, the `` is under the individual ``, but that doesn't seem to work for this plugin. It has to be outside the `` entity. – David W. Aug 13 '15 at 19:12

1 Answers1

3

The plugin is not executed because it is declared under the pluginManagement section of your pom.

You should move the configuration of checksum-maven-plugin outside pluginManagement like this:

<build>
    <plugins>
        <plugin>
            ...
        </plugin>
        <plugin>
            <groupId>net.ju-n.maven.plugins</groupId>
            <artifactId>checksum-maven-plugin</artifactId>
            <version>1.3-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>generate-artifact-checksum</id>
                    <phase>package</phase>
                    <goals>
                        <goal>files</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <fileSets>
                    <fileSet>
                        <directory>${project.build.directory}/artifacts</directory>
                    </fileSet>
                </fileSets>
            </configuration>
        </plugin>
        <plugin>
            ...
        </plugin>
    </plugins>
</build>

Refer to this question for a description of pluginManagement section.

Community
  • 1
  • 1
Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • Intersting. I put this inside the `` section because this was a super pom, and I wanted the projects that use this POM to automatically generate check sums. All the other plugins listed under plugin management were *standard* plugins, so I guess that's why I didn't notice it before. Adding it to a non `` section causes `mvn install` to fail because there's no files to take the checksum of. I tried setting `failOnError` to `false`, but it still won't install. Oh well, I guess I'll manually do a `checksum:files`. It's mainly for Jenkins anyway... – David W. Aug 13 '15 at 20:22