I am stuck on two things while writing a plugin: (1) configuration,
and (2) binding to the right goal/phase automatically.  I am using
Maven 3.0.3, and trying to use the plugin for APK (android) packaged
modules.

(1) configuration.

/**
 * @phase compile
 * @goal myGoal
 * @requiresDependencyResolution runtime
 */
public class MyMojo extends AbstractMojo {

  /**
   * @parameter expression="${myGoal.aVal}" default-value="defaultVal"
   */
  String aVal;

…
}


And in my pom using the plugin:

<build>
                <plugins>
                        <plugin>
                                <groupId>my.package</groupId>
                                <artifactId>my-plugin-test</artifactId>
                                <version>1.0-SNAPSHOT</version>
                                <configuration>
                                        <aVal>myConfiguredValue</aVal>
                                </configuration>
                                <executions>
                                        <execution>
                                                
<phase>generate-resources</phase>
                                                <goals>
                                                        <goal>myGoal</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

...

The problem is that I always get the default value instead of the
configured value.  What am I missing?

Am I required to provide the plugin.xml file, even for this simple case?

(2) Binding to the right goal/phase.

Ideally in the above example I don't want to specify <executions> for
my plugin.  But I can't figure out how to vary my annotations to get
it to work.

Can someone point out the problem, or a simple concrete example that
demonstrates this case please?

Thanks,
CP

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to