On 12-01-17 07:24 PM, Jeff Trent wrote:
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

The expression should just be aVal... btw. what are you trying to do that the Android Maven Plugin does not do? You could implement the feature as a mojo there become part of that strong community..

manfred

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

Reply via email to