Is it possible to get an instance of org.apache.maven.project.MavenProject
or some other object form of the POM from just the pom.xml file?
Thanks in advance.
In maven pom. xml , a property is accessed by using ${property_name} . You can define your custom properties in Maven.
The plugin is part of the Maven Super Pom and executed during the process-resources phase of the Jar Default Lifecyle. The only thing you have to do is to active filtering. How you make this property then available to your Java application is up to you - reading it from the classpath would work.
As the name suggests, we can point out a parent pom.xml file for the current pom.xml file. Doing so, dependencies, properties, constants and many more defined at the parent pom.xml file also get merged with the current pom.xml (child pom.xml) file.
model version is the version of project descriptor your POM conforms to. It needs to be included and is set. The value 4.0. 0 just indicated that it is compatible Maven 3.
yes you can . This is the code. You need maven-model-3.0.4.jar and plexus-utils-2.0.6.jar and maven-core-3.0.4.jar
Model model = null;
FileReader reader = null;
MavenXpp3Reader mavenreader = new MavenXpp3Reader();
try {
reader = new FileReader(pomfile);
model = mavenreader.read(reader);
model.setPomFile(pomfile);
}catch(Exception ex){}
MavenProject project = new MavenProject(model);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With