[forge-issues] [JBoss JIRA] (FORGE-430) Fix MavenCoreFacetImpl getPom()

Lincoln Baxter III (JIRA) jira-events at lists.jboss.org
Wed Oct 24 14:29:01 EDT 2012


     [ https://issues.jboss.org/browse/FORGE-430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lincoln Baxter III updated FORGE-430:
-------------------------------------

    Fix Version/s:     (was: Future)

    
> 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
>
>
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list