Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Dealing with warproduct

Hello,

Holger Staudacher' warproduct is very usefull for exporting Equinox war product from Eclipse. But I didn't find how to mavenize this kind of project.
For testing, I have tried to make a pom that deals with warproduct in Tycho. Surprisingly, it was "easy" because warproduct is very similar to product.
Perhaps you can help me to improve the method or give me a simplier alternative.

I have some questions :
        - is it possible to force tycho director plugin to use other extension than .product ? Perhaps a configuration to force product filename...
        - is there a plan to deal with warproduct in Tycho ? Or is it possible to add it ?

At the moment, I can just package OSGI/Equinox  war with Tycho (I didn't deal with RAP). My goal is making OSGI Web services for Tomcat
My source is RAP demo : thanks for that
                https://eclipse.googlesource.com/rap/org.eclipse.rap/+/2.2.0-R/releng/org.eclipse.rap.examples.build/rapdemo/product/pom.xml

The followings described how to do :
- A maven module for web service source code with packaging type : eclipse-plugin.
        it contains : all java classes and component.xml if needed
        I use OSGi JAX-RS Connector (also from Holger Staudacher) for annotated them as Web services.
- A maven module for war product :
        it contains :
                WEB-INF directory with launch.ini and web.xml
                the warproduct modified to point on this web.xml
The pom.xml of this last module is the same as RAP demo. The only problem is the config.ini path :
        - is there a way to use variables instead of win32/win32/x86 ?
                <file>target/products/${project.artifactId}/win32/win32/x86/configuration/config.ini</file>

The assembly.xml is slightly different :
<assembly>
        <id>osgi-rest-example-war</id>
        <formats>
                <format>war</format>
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>
        <fileSets>
                <fileSet>
                        <!-- TODO : path with variables ? -->
                        <directory>${basedir}/target/products/${artifactId}/win32/win32/x86</directory>
                        <outputDirectory>/WEB-INF</outputDirectory>
                        <excludes>
                                <exclude>plugins/javax.servlet*.jar</exclude>
                                <exclude>artifacts.xml</exclude>
                                <exclude>p2/**</exclude>
                        </excludes>
                </fileSet>
                <fileSet>
                        <directory>${basedir}/WEB-INF</directory>
                        <outputDirectory>/WEB-INF</outputDirectory>
                </fileSet>
                <fileSet>
                        <directory>${basedir}/target/products/${artifactId}/win32/win32/x86/plugins</directory>
                        <outputDirectory>/WEB-INF/lib</outputDirectory>
                        <includes>
                                <include>org.eclipse.equinox.servletbridge_*.jar</include>
                        </includes>
                </fileSet>
        </fileSets>
</assembly>


For now, I have to rename warproduct into product before because I can't force product filename :
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-antrun-plugin</artifactId>
                                <version>1.7</version>
                                <executions>
                                        <execution>
                                                <id>create_product_from_warproduct</id>
                                                <phase>validate</phase>
                                                <configuration>
                                                        <target name="copy and rename file">
                                                                <copy file="${basedir}/${project.artifactId}.warproduct"
                                                                        tofile="${basedir}/${project.artifactId}.product" overwrite="true" failonerror="true"/>
                                                        </target>
                                                </configuration>
                                                <goals>
                                                        <goal>run</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>


Regards

David

Back to the top