You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Bauer (JIRA)" <ji...@codehaus.org> on 2009/03/13 15:02:13 UTC

[jira] Commented: (MNG-2971) Variables are not replaced into installed pom file

    [ http://jira.codehaus.org/browse/MNG-2971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=169243#action_169243 ] 

Christian Bauer commented on MNG-2971:
--------------------------------------

Until the install plugin is fixed, there is the following workaround:

You first replace the variables in the pom during the build process by using the assembly plugin
and install the modified file afterwards over the orginal pom.

Modified pom:

<plugin>
	<artifactId>maven-assembly-plugin</artifactId>
          <executions>
            <execution><!--  Replace the placeholder of the pom by their values (used by the install plugin below)-->
              <id>replace-pom-placeholder</id>
              <phase>package</phase>
              <goals><goal>single</goal></goals>
              <configuration>
                <finalName>modified-pom</finalName>
                <descriptors>
                  <descriptor>src/assemble/replacePomPlaceholder.xml</descriptor>
                </descriptors>
              </configuration>
            </execution>
          </executions>
</plugin>
			
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
          <executions>
            <execution><!-- Replaces the pom (with placeholders) in the repository with the pom without placeholders -->
              <id>overwrite-pom</id>
              <phase>install</phase>
              <goals>
                <goal>install-file</goal>
              </goals>
              <configuration>
                <file>target/modified-pom-replacePomPlaceholder/modified-pom/pom.xml</file>
                <pomFile>target/modified-pom-replacePomPlaceholder/modified-pom/pom.xml</pomFile>
              </configuration>
            </execution>
          </executions>
      </plugin>


Assembly Descriptor replacePomPlaceholder.xml

<assembly>
  
  <id>replacePomPlaceholder</id>
  <formats>
    <format>dir</format>
  </formats>
  
  
   <files>
    <file>
      <source>pom.xml</source>
      <outputDirectory>/</outputDirectory>
      <filtered>true</filtered>
    </file>
  </files>

</assembly>


> Variables are not replaced into installed pom file
> --------------------------------------------------
>
>                 Key: MNG-2971
>                 URL: http://jira.codehaus.org/browse/MNG-2971
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Deployment, Inheritance and Interpolation
>         Environment: Windows, Solaris
> Maven version 2.0.4
>            Reporter: Laurent Dauvilaire
>            Assignee: Ralph Goers
>             Fix For: 2.0.x
>
>
> Variables are not replaced into installed pom file.
> Here is a sample pom file
> <project xmlns="http://maven.apache.org/POM/4.0.0"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> 	<modelVersion>4.0.0</modelVersion>
> 	<groupId>com.xxx.root</groupId>
> 	<artifactId>root</artifactId>
> 	<packaging>pom</packaging>
> 	<version>${prop.version}</version>
> 	<name>My Project</name>
>         ...
> 	<properties>
> 		<prop.version>3.0.20</prop.version>
> 	</properties>
> </project>
> The installed pom is into ${localRepository}/com/xxx/root/root/3.0.20/root-3.0.20.pom
> is the same as the project pom file but the version referenced into the installed pom file is ${prop.version} instead of 3.0.20
> which creates problem to artifacts depending of this one.
> Thanks in advance

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira