2

I'm trying to replace a variable in my p2.inf during the build phase using the maven-resources-plugin.

According to this post I copied the p2.inf to another directory using filtering to replace my variable and in a later phase copy the filtered p2.inf back to it's original folder.

This works fine for the p2.inf on the filesystem, the variable is replaced, everything looks good. Unfortunately the p2.inf in the jar file still contains the unreplaced variable.

I tried all phase to copy the file back but without success. I'm looking forward to all ideas for this problem!

Here some of my files:

p2.inf

instructions.configure=\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:0,location:http${#58}//SERVERIP${#58}8081/nexus/${scmBranch}/updates/);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:1,location:http${#58}//SERVERIP${#58}8081/nexus/${scmBranch}/updates/);

extract from pom.xml

<build>
    <plugins>
             <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                  <execution>
                    <id>copy-p2-to-filter-initialize</id>
                    <!-- Tried several phases here -->
                    <phase>initialize</phase>
                    <goals>
                      <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                      <overwrite>true</overwrite>
                      <outputDirectory>${feature.directory}/copiedp2</outputDirectory>
                      <resources>          
                    <resource>
                        <directory>${feature.directory}</directory>
                        <filtering>true</filtering>
                        <includes>
                            <include>p2.inf</include>
                        </includes>
                    </resource>
                      </resources>              
                    </configuration>            
                  </execution>
                  <execution>
                    <id>copy-p2-back-prepare-package</id>
                    <!-- Tried several phases here also -->
                    <phase>prepare-package</phase>
                    <goals>
                      <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                      <overwrite>true</overwrite>
                      <outputDirectory>${feature.directory}</outputDirectory>
                      <resources>          
                    <resource>
                        <directory>${feature.directory}/copiedp2</directory>
                        <filtering>false</filtering>
                        <includes>
                            <include>p2.inf</include>
                        </includes>
                    </resource>
                      </resources>              
                    </configuration>             
                  </execution>
                  <execution>
             </plugin>      
        </plugins>
 </build>

The feature structure is pretty simple:

feature
   - build.properties
   - feature.xml
   - p2.inf

If I should provide more details, just let me know.

Vincent
  • 199
  • 1
  • 14

0 Answers0