I created an archetype with maven, which includes archetype-post-generate.groovy, but it is not executed.
This is a fragment of the pom:
<properties>
<maven.archetype.version>3.2.0</maven.archetype.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>${maven.archetype.version}</version>
</plugin>
</plugins>
</pluginManagement>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${maven.archetype.version}</version>
</extension>
</extensions>
</build>
However, the version of the plugin does not match the one defined in the pom:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
Could that be the reason why it doesn't run the groovy script? Why does the version not match?
EDIT: Complete POM with suggested changes:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>bp-archetype-bcore</artifactId>
<groupId>global.base</groupId>
<version>1.0.0</version>
<packaging>maven-archetype</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>${maven.archetype.version}</version>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${maven.archetype.version}</version>
</extension>
</extensions>
</build>
</project>
Declaring a plugin just in
<pluginManagement>adds nothing to the build. This is just kind of a template which configuration should be used if the plugin is declared in this or a child POM's<build><plugins>section.See POM Reference, Plugin Management: