我想做成对的文件,看起来像
<configuration>
<params>
<param>
<wsdl>${basedir}/File1.wsdl</wsdl>
<result>D:/file1</result>
</param>
<param>
<wsdl>${basedir}/File2.wsdl</wsdl>
<result>D:/file2</result>
</param>
</params>
</configuration>
这是代码
/**
*
* @goal merge
* @requiresProject true
*/
public class MavenPlugin extends AbstractMojo
{
/**
*
* @parameter
* @requared
*/
public List<TwoFiles> params;
public void execute() throws MojoExecutionException, MojoFailureException
{
if (params == null || params.isEmpty())
{
throw new IllegalArgumentException("params is requared");
}
....
public class TwoFiles
{
public File wsdl;
public File result;
}
不能很好地工作。
有任何想法吗?
回答:
public class MainExecutor extends AbstractMojo
{
/**
* @parameter
*/
private List<Param> params;
...
public class Param
{
public File wsdl;
public File result;
}
效果很好....