[
https://issues.jboss.org/browse/FORGE-430?page=com.atlassian.jira.plugin....
]
Lincoln Baxter III closed FORGE-430.
------------------------------------
Assignee: Lincoln Baxter III
Fix Version/s: 1.0.0.CR1
Resolution: Won't Fix
Hi Max,
As I said before. getPOM() is a low level Facet and does not resolve properties (for
instance, what if we wanted to know where properties were used, or to add or change
properties. If we resolved this information here, we would not be able to do that.)
Take a look at the DependencyFacet. This provides the information you are looking for, and
does automatic property resolution for dependencies.
You are right, however, that we should have this ability on MavenCoreFacet itself;
therefore, if you want to resolve a property in another artifact, e.g. not a dependency,
then until CR1 you need to get the properties from the POM and resolve them yourself, but
in/after CR1 you will be able to call:
{code}String MavenCoreFacet.resolveProperties(String valueWithUnresolvedProperties){code}
I've added this in the latest commit.
I hope this helps,
~Lincoln
Fix MavenCoreFacetImpl getPom()
-------------------------------
Key: FORGE-430
URL:
https://issues.jboss.org/browse/FORGE-430
Project: Forge
Issue Type: Bug
Affects Versions: 1.0.0.Beta5
Environment: Windows 7, Desktop PC
Reporter: Max Schwaab
Assignee: Lincoln Baxter III
Priority: Minor
Labels: maven
Fix For: 1.0.0.CR1, Future
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.
{code:title=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);
}
}
{code}
Example for my plugins pom.xml
{code}
<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>
{code}
Best regards
Max
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira