Is it possible to use a defined parameter in another parameter? For example I tried this and figured out this is not allowed:
@Parameter(required = true)
private String semester;
@Parameter(defaultValue = "${basedir}/src/main/resources/" + semester)
private String inputFolder;
My second try was to put use the parameter as expression:
@Parameter(defaultValue = "${basedir}/src/main/resources/${semester}")
private String inputFolder;
This was also a fail. The next iteration: I wrote the parameter as property at plugin's execution:
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
Properties props = project.getProperties();
props.put("semester", semester);
}
This doesn't work either, because the parameters are injected before execute()
is executed. The only solution I get to is to replace the expressions by myself:
inputFolder = inputFolder.replace("${semester}", semester);
outputFolder = outputFolder.replace("${semester}", semester);