java - Mapping complex objects in maven plugin -
i want configure complex objects in maven plugin .. -
<?xml version="1.0" encoding="utf-8"?> <project> <modelversion>4.0.0</modelversion> <groupid>com.test.helloworld</groupid> <artifactid>hw</artifactid> <version>1.0.0</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupid>com.test.my.maven.plugin</groupid> <artifactid>my-maven-plugin</artifactid> <version>1.0.0</version> <extensions>true</extensions> <configuration> <myobject> <name>mike</name> <age>23</age> <props> <property> <key>test</key> <value>testvalue</value> </property> </props> </myobject> </configuration> </plugin> </plugins> </build> </project> and here sample mojo in want use these configurations -
public class testmojo extends abstractmojo{ @parameter private map<string, object> myobject; @override public void execute() throws mojoexecutionexception, mojofailureexception { string name = (string)myobject.get("name"); string age = (string)myobject.get("age"); properties props = (properties)myobject.get("props"); } } but gives me null value myobject. have tried creating class mentioned here gives me null value. how can such complex mapping in maven mojo ?
Comments
Post a Comment