javamavenpom.xmlmaven-plugin-development

Accessing Maven Pom Variables From Properties File


I am developing a custom maven plugin. When I write:

${project.version}

into my pom file I can get its value however is there a way if I write into a properties file:

project.version = ${project.version}

that will set the project.version value correctly, how can I implement it at my Java code?

PS: I don't use annotations at my Mojo and I don't want to use variables at my Java code because user should define as my variables as at a properties file and I can not change my core Java code in order to changed things.


Solution

  • You can use Maven resource filtering by simply adding <resources> inside <build> and turning on filtering for anything you want.