Please have a look at org.jboss.forge.maven.facets.MavenCoreFacetImpl in the forge-project-model-maven project.
The getPom() method reads the pom directly from the file resource. This results in a warning when using maven properties for dependency versions, e.g. when you try to install a plugin via the source-plugin command (**WARNING** Could not resolve dependency [org.some:dependency:jar::${some.version}])
The plugin works after installation and I don't know if its important to resolve this issue, but in the code is a "//FIXME"-remark too. The same may be relevant for setPOM(final Model pom) too.
MavenCoreFacetImpl getPom()
@Override public Model getPOM() { try { Model result = new Model(); // FIXME this should/can-not use the Maven Native file writer if we are going to abstract file APIs MavenXpp3Reader reader = new MavenXpp3Reader(); FileInputStream stream = new FileInputStream(getPOMFile().getUnderlyingResourceObject()); if (stream.available() > 0) { result = reader.read(stream); } stream.close(); result.setPomFile(getPOMFile().getUnderlyingResourceObject()); return result; } catch (IOException e) { throw new ProjectModelException("Could not open POM file: " + getPOMFile(), e); } catch (XmlPullParserException e) { throw new ProjectModelException("Could not parse POM file: " + getPOMFile(), e); } }
Example for my plugins pom.xml
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <properties> <some.version>1.0</some.version> </properties> <dependencies> <dependency> <groupId>org.some</groupId> <artifactId>dependency</artifactId> <version>${some.version}</version> </dependency> </dependencies> <repositories> <repository> <id>repository.some</id> <name>Some Repository for Maven</name> <url>http://some.repo.url</url> </repository> </repositories> </project>
Best regards
Max