I have written a custom plugin, then I installed it. Then I modified the pom.xml of the project from which I want to use the custom plugin.  When I invoke my plugin goal directly the plugin goal is executed successfully, but when I try to mvn compile my custom plugin goal is not executed.  What might be the reason?
My plugin's pom.xml:
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xxx.plugins.maven</groupId>
  <artifactId>datanucleus-enhance-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Datanucleus-enhance Maven Plugin</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
My project using custom plugin I added following:
    <!-- enhance JDO classes -->
    <plugin>
      <groupId>com.sukantu.plugins.maven</groupId>
      <artifactId>datanucleus-enhance-maven-plugin</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <configuration>
        <jdoClassDirList>
          <param>target/${project.artifactId}-${project.version}/WEB-INF/classes/</param>
        </jdoClassDirList>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
    </plugin>
I followed section Attaching the Mojo to the Build Lifecycle from maven guide site: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
The following command successfully calls my plugin goal:
mvn com.xxx.plugins.maven:datanucleus-enhance-maven-plugin:enhance
The following command does NOT successfully call my plugin goal:
mvn compile
Thanks for any inputs!
 
     
    