在RCP的构建阶段,在Maven / Tycho中进行P2.inf过滤

时间:2018-03-09 09:12:44

标签: java maven eclipse-rcp tycho maven-resources-plugin

我正在尝试使用maven-resources-plugin在构建阶段替换p2.inf中的变量。

根据this帖子,我将p2.inf复制到另一个目录,使用过滤替换我的变量,稍后将过滤后的p2.inf复制回原来的文件夹。

这适用于文件系统上的p2.inf,变量被替换,一切看起来都不错。不幸的是,jar文件中的p2.inf仍然包含未放置的变量。

我尝试了所有阶段复制文件但没有成功。我期待着这个问题的所有想法!

这里有一些我的文件:

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/);

从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>

功能结构非常简单:

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

如果我应该提供更多细节,请告诉我。

0 个答案:

没有答案