You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mansour Al Akeel <ma...@gmail.com> on 2025/11/14 16:25:28 UTC

Injecting parameters with default values in Mojo is failing

I am trying to experiment with writing a custom plugin, and started toying
around with a sample project. The first brick wall is injecting parameters
with default values using PluginParameterExpressionEvaluator.

The issues I am having is with something like this:

@Parameter(property = "buildDirectory", defaultValue =
"${project.build.directory}", required = false)
private File outputDirectory;

@Parameter(property = "sourceDirectory", name = "sourceDirectory",
defaultValue = "${project.sourceDirectory}", required = true)
private File sourceDirectory;


These are always nulls. I have created a sample project to demonstrate the
issue:

https://github.com/malakeel/sample-maven-plugin/tree/main

The issue I am facing is generated when I run SQLProcessorMojoTest.java
from within eclipse.