Difference between revisions of "Scout/Tutorial/3.8/Maven Tycho Build"

From Eclipsepedia

< Scout‎ | Tutorial‎ | 3.8
Jump to: navigation, search
(Part I - Maven Tycho Integration)
(Maven Tycho Integration of existing Plugins)
 
(19 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
This tutorial shows how to build an existing Scout application using [http://www.eclipse.org/tycho/ Maven Tycho]. Therefore we use the {{ScoutLink|Tutorial/3.8/Minicrm/Minicrm Step-by-Step|name=Minicrm application}} as base.
+
This tutorial shows how to build an existing Scout application using [http://www.eclipse.org/tycho/ Maven Tycho]. Therefore we use the {{ScoutLink|Tutorial/3.8/Minicrm/Minicrm Step-by-Step|name=Minicrm application}} as base Scout application to integrate it into the Maven Tycho world.
  
 
== Installation / Prerequisites ==
 
== Installation / Prerequisites ==
Line 12: Line 12:
  
 
==== [http://eclipse.org/m2e/ m2eclipse] ====
 
==== [http://eclipse.org/m2e/ m2eclipse] ====
Updatesite-URL: http://download.eclipse.org/technology/m2e/releases
+
Updatesite-URL: http://download.eclipse.org/releases/juno (or http://download.eclipse.org/technology/m2e/releases)
 
  choose: m2e - Maven Integration for Eclipse (1.1.0.20120530-0009)
 
  choose: m2e - Maven Integration for Eclipse (1.1.0.20120530-0009)
 +
 +
{{tip|Old version|Version 1.1.0 is not the current version. Therefore you might need to uncheck "Show only the latest versions of available software" to see this version in the list.}}
 +
 
Install m2e connectors: ''Window > Preferences > Maven > Discovery > Open Catalog''
 
Install m2e connectors: ''Window > Preferences > Maven > Discovery > Open Catalog''
 
  choose: Tycho Configurator
 
  choose: Tycho Configurator
  
 
==== Optional: [http://www.eclipse.org/egit/ EGit] ====
 
==== Optional: [http://www.eclipse.org/egit/ EGit] ====
Updatesite-URL: http://download.eclipse.org/egit/updates
+
Updatesite-URL: http://download.eclipse.org/releases/juno (or http://download.eclipse.org/egit/updates)
 
  choose: Eclipse EGit (2.0.0.201206130900-r)
 
  choose: Eclipse EGit (2.0.0.201206130900-r)
 
         Eclipse JGit (2.0.0.201206130900-r)
 
         Eclipse JGit (2.0.0.201206130900-r)
Line 25: Line 28:
 
Installation guide: http://maven.apache.org/download.html#Installation
 
Installation guide: http://maven.apache.org/download.html#Installation
  
== Part I - Maven Tycho Integration ==
+
== Maven Tycho Integration of existing Plugins ==
 
:1. Create new Eclipse Project (used as parent POM)
 
:1. Create new Eclipse Project (used as parent POM)
 
:2. Generate POMs for existing projects / plug-ins
 
:2. Generate POMs for existing projects / plug-ins
Line 32: Line 35:
 
     -DgroupId=org.eclipse.minicrm
 
     -DgroupId=org.eclipse.minicrm
 
     -Dversion=1.0.0-SNAPSHOT
 
     -Dversion=1.0.0-SNAPSHOT
     -DextraDirs==../org.eclipse.minicrm.client,../org.eclipse.minicrm.server,../org.eclipse.minicrm.shared,../org.eclipse.minicrm.ui.rap,../org.eclipse.minicrm.ui.swing,../org.eclipse.minicrm.ui.swt
+
     -DextraDirs=../org.eclipse.minicrm.client,../org.eclipse.minicrm.server,../org.eclipse.minicrm.shared,../org.eclipse.minicrm.ui.rap,../org.eclipse.minicrm.ui.swing,../org.eclipse.minicrm.ui.swt
 +
</source>
 +
Sample pom.xml:
 +
<source lang="xml"><?xml version="1.0" encoding="UTF-8"?>
 +
<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">
 +
  <modelVersion>4.0.0</modelVersion>
 +
  <parent>
 +
    <groupId>org.eclipse.scout.autotest</groupId>
 +
    <artifactId>org.eclipse.scout.autotest</artifactId>
 +
    <version>1.0.0-SNAPSHOT</version>
 +
    <relativePath>../org.eclipse.scout.autotest.parent/</relativePath>
 +
  </parent>
 +
  <artifactId>org.eclipse.scout.autotest.client</artifactId>
 +
  <packaging>eclipse-plugin</packaging>
 +
</project>
 
</source>
 
</source>
 
:3. Convert every project into a Maven Project: ''Configure > Convert to Maven Project...''
 
:3. Convert every project into a Maven Project: ''Configure > Convert to Maven Project...''
Line 39: Line 57:
 
:* Delete duplicate Maven Coordinates (groupId and version)
 
:* Delete duplicate Maven Coordinates (groupId and version)
 
:5. Extend parent POM configuration
 
:5. Extend parent POM configuration
:* Add Repositories (using [http://maven.apache.org/guides/introduction/introduction-to-profiles.html Maven Profiles])
+
:* Add Eclipse and RAP platform Repositories (using [http://maven.apache.org/guides/introduction/introduction-to-profiles.html Maven Profiles])
 
<source lang="xml">
 
<source lang="xml">
 
<profiles>
 
<profiles>
Line 125: Line 143:
 
</source>
 
</source>
  
== Part II - Build Swing client (building an Eclipse Product) ==
+
== Build Eclipse Scout Swing client application (building an Eclipse Product) ==
 
:1. Create new Eclipse Project (holding the client Product)
 
:1. Create new Eclipse Project (holding the client Product)
 
:2. Add / Create Swing client Product
 
:2. Add / Create Swing client Product
Line 183: Line 201:
 
             </goals>
 
             </goals>
 
             <configuration>
 
             <configuration>
              <overwrite>true</overwrite>
 
 
               <resources>
 
               <resources>
 
                 <resource>
 
                 <resource>
                   <directory>/</directory>
+
                   <directory>${project.build.directory}/../</directory>
 
                   <filtering>false</filtering>
 
                   <filtering>false</filtering>
 
                   <includes>
 
                   <includes>
Line 236: Line 253:
 
     <!-- exported product files -->
 
     <!-- exported product files -->
 
     <fileSet>
 
     <fileSet>
    <directory>${product.outputDirectory}</directory>
+
      <directory>${product.outputDirectory}</directory>
    <outputDirectory>/${product.finalName}</outputDirectory>
+
      <outputDirectory>/${product.finalName}</outputDirectory>
 
       <excludes>
 
       <excludes>
 
         <exclude>p2/**</exclude>
 
         <exclude>p2/**</exclude>
Line 257: Line 274:
 
   <version>2.5</version>
 
   <version>2.5</version>
 
   <configuration>
 
   <configuration>
<encoding>UTF-8</encoding>
+
    <encoding>UTF-8</encoding>
 
   </configuration>
 
   </configuration>
 
</plugin>
 
</plugin>
Line 269: Line 286:
 
:6. Build parent POM
 
:6. Build parent POM
  
== Part III - Build server (building an Eclipse Product)  ==
+
== Build Eclipse Scout Server WAR (building an Eclipse Product)  ==
 
:1. Create new Eclipse Project (holding the server Product)
 
:1. Create new Eclipse Project (holding the server Product)
 
:2. Add / Create server Product
 
:2. Add / Create server Product
Line 325: Line 342:
 
             </goals>
 
             </goals>
 
             <configuration>
 
             <configuration>
              <overwrite>true</overwrite>
 
 
               <resources>
 
               <resources>
 
                 <resource>
 
                 <resource>
                   <directory>/</directory>
+
                   <directory>${project.build.directory}/../</directory>
 
                   <filtering>false</filtering>
 
                   <filtering>false</filtering>
 
                   <includes>
 
                   <includes>
Line 401: Line 417:
 
:* Extend the ''modules'' by the new Maven Module
 
:* Extend the ''modules'' by the new Maven Module
 
:6. Add WEB-INF template to match [http://www.eclipse.org/equinox/server/http_in_container.php Equinox in a Servlet Container] requirements (directory location has to match the referred ''fileSet'' in assembly.xml)
 
:6. Add WEB-INF template to match [http://www.eclipse.org/equinox/server/http_in_container.php Equinox in a Servlet Container] requirements (directory location has to match the referred ''fileSet'' in assembly.xml)
:* A running WEB-INF template can be extracted from Scout SDK exported war file. Details can be found {{ScoutLink|Tutorial/3.8/Deploy_to_Tomcat#Export_Scout_Application|name=here}}.
+
:* A running WEB-INF template can be extracted from a Scout SDK exported war file. Details can be found {{ScoutLink|Tutorial/3.8/Deploy_to_Tomcat#Export_Scout_Application|name=here}}.
 
:7. Build parent POM
 
:7. Build parent POM
  
== Part IIII - Advanced stuff ==
+
== Testing an Eclipse Scout Client/Server Application (using JUnit/Maven Tycho Surefire)  ==
=== integrate the JRE into the client zip ===
+
Using Maven Tycho Surefire you can test your Eclipse Scout Application automatically. A sample application is on https://github.com/innovad/scout.autotest.demo. More details tbd.
Extend the assembly.xml's ''fileSets'' definition
+
=== Plugin/Fragment/Feature Setup ===
 +
Create the required testing plugins and fragments for your Scout application. You will have to create a plugin and a fragment for each module (client, server, shared) to be tested. We recommend to use the following naming conventions:
 +
:* org.yourapp.client
 +
:* <b>org.yourapp.client.test</b>
 +
:** A plugin holding some support classes (no JUnit tests here)
 +
:* <b>org.yourapp.client.test.fragment</b>
 +
:** A fragment with host <b>org.yourapp.client</b> containing the JUnit tests. The tests will be loaded with the plugin to be tested by the OSGi framework.
 +
:* org.yourapp.server
 +
:* <b>org.yourapp.server.test</b>
 +
:** similar as above
 +
:* <b>org.yourapp.server.test.fragment</b>
 +
:** similar as above
 +
:* org.yourapp.shared
 +
:* <b>org.yourapp.shared.test</b>
 +
:** similar as above
 +
:* <b>org.yourapp.shared.test.fragment</b>
 +
:** similar as above
 +
:* org.yourapp.client.feature
 +
:* org.yourapp.server.feature
 +
:* org.yourapp.server.product
 +
:* org.yourapp.ui.swing.product
 +
:* org.yourapp.ui.swing
 +
:* org.yourapp.parent
 +
:* org.yourapp.target
 +
 
 +
=== Testing Server ===
 +
=== Testing Shared ===
 +
=== Testing Client ===
 +
=== Debugging a Test ===
 +
* Add the "debugPort" to your pom.xml
 +
<source lang="xml"><plugin>
 +
<groupId>org.eclipse.tycho</groupId>
 +
<artifactId>tycho-surefire-plugin</artifactId>
 +
<version>${tycho.version}</version>
 +
<configuration>
 +
      <debugPort>18081</debugPort>
 +
</configuration>
 +
</plugin>
 +
</source>
 +
* Create a new Debug Configuration in Eclipse of type "Remote Java Application" (localhost:18081)
 +
* Tycho stops with "Listening for transport dt_socket at address: 18081"
 +
* At this point, Run your Debug Configuration
 +
 
 +
== Advanced Topics ==
 +
=== Support [http://marketplace.eclipse.org/content/rayo-look-and-feel-eclipse-scout Rayo Look and Feel for Eclipse Scout]  ===
 +
Add new P2-''Repository'' with the corresponding Update Site URL
 +
 
 +
=== Support [http://marketplace.eclipse.org/content/jdbc-drivers-eclipse-scout JDBC Drivers for Eclipse Scout] ===
 +
Add new P2-''Repository'' with the corresponding Update Site URL
 +
 
 +
=== Integrate the JRE into the client zip ===
 +
Extend the assembly.xml's ''fileSets'' definition:
 
<source lang="xml">
 
<source lang="xml">
 
<!-- integrate the JRE into the client zip -->
 
<!-- integrate the JRE into the client zip -->
Line 414: Line 481:
 
</fileSet>
 
</fileSet>
 
</source>
 
</source>
 +
 +
=== Bundle client and server together (to support direct client download) ===
 +
{{note|TODO|Add a description}}

Latest revision as of 06:32, 1 March 2013

Contents

[edit] Introduction

This tutorial shows how to build an existing Scout application using Maven Tycho. Therefore we use the Minicrm application as base Scout application to integrate it into the Maven Tycho world.

[edit] Installation / Prerequisites

This tutorial assumes that your environment fulfills the following requirements.

[edit] Eclipse

[edit] Eclipse for Scout Developers Juno

Download-URL: http://www.eclipse.org/downloads/packages/eclipse-scout-developers/junor

[edit] m2eclipse

Updatesite-URL: http://download.eclipse.org/releases/juno (or http://download.eclipse.org/technology/m2e/releases)

choose: m2e - Maven Integration for Eclipse	(1.1.0.20120530-0009)
Idea.png
Old version
Version 1.1.0 is not the current version. Therefore you might need to uncheck "Show only the latest versions of available software" to see this version in the list.


Install m2e connectors: Window > Preferences > Maven > Discovery > Open Catalog

choose: Tycho Configurator

[edit] Optional: EGit

Updatesite-URL: http://download.eclipse.org/releases/juno (or http://download.eclipse.org/egit/updates)

choose: Eclipse EGit	(2.0.0.201206130900-r)
        Eclipse JGit	(2.0.0.201206130900-r)

[edit] Maven

Installation guide: http://maven.apache.org/download.html#Installation

[edit] Maven Tycho Integration of existing Plugins

1. Create new Eclipse Project (used as parent POM)
2. Generate POMs for existing projects / plug-ins
mvn org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms
    -DgroupId=org.eclipse.minicrm
    -Dversion=1.0.0-SNAPSHOT
    -DextraDirs=../org.eclipse.minicrm.client,../org.eclipse.minicrm.server,../org.eclipse.minicrm.shared,../org.eclipse.minicrm.ui.rap,../org.eclipse.minicrm.ui.swing,../org.eclipse.minicrm.ui.swt

Sample pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.eclipse.scout.autotest</groupId>
    <artifactId>org.eclipse.scout.autotest</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../org.eclipse.scout.autotest.parent/</relativePath>
  </parent>
  <artifactId>org.eclipse.scout.autotest.client</artifactId>
  <packaging>eclipse-plugin</packaging>
</project>
3. Convert every project into a Maven Project: Configure > Convert to Maven Project...
4. [Optional] Resolve Warnings caused by the previous steps (see Problems-View)
  • Delete every bin directory and fix build.properties files (Cause: The project's output folder was changed from /bin to /target/classes)
  • Delete duplicate Maven Coordinates (groupId and version)
5. Extend parent POM configuration
<profiles>
  <profile>
    <id>platform-juno</id>
    <activation>
      <activeByDefault>true</activeByDefault>
      <property>
        <name>platform-version-name</name>
        <value>juno</value>
      </property>
    </activation>
    <properties>
      <eclipse.repo.url>http://download.eclipse.org/releases/juno</eclipse.repo.url>
      <rap.repo.url>http://download.eclipse.org/rt/rap/1.5/runtime</rap.repo.url>
      <platform.version>[3.8,3.9)</platform.version>
      <tycho.version>0.15.0</tycho.version>
    </properties>
  </profile>
</profiles>
 
<repositories>
  <repository>
    <id>eclipse platform</id>
    <url>${eclipse.repo.url}</url>
    <layout>p2</layout>
  </repository>
  <repository>
    <id>rap platform</id>
    <url>${rap.repo.url}</url>
    <layout>p2</layout>
  </repository>
</repositories>
<build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-maven-plugin</artifactId>
      <version>${tycho.version}</version>
      <extensions>true</extensions>
    </plugin>
 
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>target-platform-configuration</artifactId>
      <configuration>
        <environments>
          <environment>
            <os>win32</os>
            <ws>win32</ws>
            <arch>x86</arch>
          </environment>
        </environments>
      </configuration>
    </plugin>
  </plugins>
 
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <version>${tycho.version}</version>
        <configuration>
          <filters>
            <!-- work around Equinox bug 348045 -->
            <filter>
              <type>p2-installable-unit</type>
              <id>org.eclipse.equinox.servletbridge.extensionbundle</id>
              <removeAll />
            </filter>
          </filters>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>
6. Build parent POM
mvn clean package

[edit] Build Eclipse Scout Swing client application (building an Eclipse Product)

1. Create new Eclipse Project (holding the client Product)
2. Add / Create Swing client Product
  • Important: Tycho only supports *.product file in the project root
  • Important: The *.product file has to contain the attribute 'uid' (correspond to the ID field in the Product Configurator view)
3. Create POM configuration
  • pom.xml
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.eclipse.minicrm</groupId>
    <artifactId>org.eclipse.minicrm</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../org.eclipse.minicrm/</relativePath>
  </parent>
  <artifactId>org.eclipse.minicrm.swing.product</artifactId>
  <packaging>eclipse-repository</packaging>
 
  <properties>
    <product.id>org.eclipse.minicrm.swing</product.id>
    <product.outputDirectory>${project.build.directory}/products/${product.id}/win32/win32/x86</product.outputDirectory>
    <product.finalName>minicrm</product.finalName>
  </properties>
 
  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-director-plugin</artifactId>
        <executions>
          <execution>
            <id>materialize-products</id>
            <phase>package</phase>
            <goals>
              <goal>materialize-products</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <products>
            <product>
              <id>${product.id}</id>
            </product>
          </products>
        </configuration>
      </plugin>
 
      <!-- Workaround: Use an existing config.ini file (caused by the problem that tycho will always generate a default one) -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${project.build.directory}/../</directory>
                  <filtering>false</filtering>
                  <includes>
                    <include>config.ini</include>
                  </includes>
                </resource>
              </resources>
              <outputDirectory>${product.outputDirectory}/configuration</outputDirectory>
              <overwrite>true</overwrite>
            </configuration>
          </execution>
        </executions>
      </plugin>
 
 
      <!-- Configure the assembly plugin to build the final client zip file -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>assembly.xml</descriptor>
          </descriptors>
          <finalName>${product.finalName}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
  • assembly.xml
<assembly>
  <id>org.eclipse.minicrm.client.zip</id>
  <formats>
    <format>zip</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <!-- exported product files -->
    <fileSet>
      <directory>${product.outputDirectory}</directory>
      <outputDirectory>/${product.finalName}</outputDirectory>
      <excludes>
        <exclude>p2/**</exclude>
        <exclude>eclipsec.exe</exclude>
        <exclude>artifacts.xml</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>
4. Convert to a Maven Project: Configure > Convert to Maven Project...
5. Update the parent POM
  • Extend the modules by the new Maven Module
  • Define the newly used Maven Plugins in pluginManagement
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.5</version>
  <configuration>
    <encoding>UTF-8</encoding>
  </configuration>
</plugin>
 
<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-p2-director-plugin</artifactId>
  <version>${tycho.version}</version>
</plugin>
6. Build parent POM

[edit] Build Eclipse Scout Server WAR (building an Eclipse Product)

1. Create new Eclipse Project (holding the server Product)
2. Add / Create server Product
3. Create POM configuration
  • pom.xml
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.eclipse.minicrm</groupId>
    <artifactId>org.eclipse.minicrm</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../org.eclipse.minicrm/</relativePath>
  </parent>
  <artifactId>org.eclipse.minicrm.server.product</artifactId>
  <packaging>eclipse-repository</packaging>
 
  <properties>
    <product.id>org.eclipse.minicrm.server.product</product.id>
    <product.outputDirectory>${project.build.directory}/products/${product.id}/win32/win32/x86</product.outputDirectory>
    <product.finalName>minicrm</product.finalName>
  </properties>
 
  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-director-plugin</artifactId>
        <executions>
          <execution>
            <id>materialize-products</id>
            <phase>package</phase>
            <goals>
              <goal>materialize-products</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <products>
            <product>
              <id>${product.id}</id>
            </product>
          </products>
        </configuration>
      </plugin>
 
      <!-- Workaround: Use an existing config.ini file (caused by the problem that tycho will always generate a default one) -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${project.build.directory}/../</directory>
                  <filtering>false</filtering>
                  <includes>
                    <include>config.ini</include>
                  </includes>
                </resource>
              </resources>
              <outputDirectory>${product.outputDirectory}/configuration</outputDirectory>
              <overwrite>true</overwrite>
            </configuration>
          </execution>
        </executions>
      </plugin>
 
 
      <!-- Configure the assembly plugin to build the final server war file -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>assembly.xml</descriptor>
          </descriptors>
          <finalName>${product.finalName}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
  • assembly.xml
<assembly>
  <id>org.eclipse.minicrm.server.war</id>
  <formats>
    <format>war</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <!-- web-inf template -->
    <fileSet>
      <directory>${basedir}/templates/WEB-INF</directory>
      <outputDirectory>/WEB-INF</outputDirectory>
      <includes>
        <include>**</include>
      </includes>
    </fileSet>
 
    <!-- exported product files -->
    <fileSet>
      <directory>${product.outputDirectory}</directory>
      <outputDirectory>/WEB-INF/eclipse</outputDirectory>
      <includes>
        <include>configuration/**</include>
        <include>plugins/**</include>
      </includes>
    </fileSet>
  </fileSets>
</assembly>
4. Convert to a Maven Project: Configure > Convert to Maven Project...
5. Update the parent POM
  • Extend the modules by the new Maven Module
6. Add WEB-INF template to match Equinox in a Servlet Container requirements (directory location has to match the referred fileSet in assembly.xml)
  • A running WEB-INF template can be extracted from a Scout SDK exported war file. Details can be found here.
7. Build parent POM

[edit] Testing an Eclipse Scout Client/Server Application (using JUnit/Maven Tycho Surefire)

Using Maven Tycho Surefire you can test your Eclipse Scout Application automatically. A sample application is on https://github.com/innovad/scout.autotest.demo. More details tbd.

[edit] Plugin/Fragment/Feature Setup

Create the required testing plugins and fragments for your Scout application. You will have to create a plugin and a fragment for each module (client, server, shared) to be tested. We recommend to use the following naming conventions:

  • org.yourapp.client
  • org.yourapp.client.test
    • A plugin holding some support classes (no JUnit tests here)
  • org.yourapp.client.test.fragment
    • A fragment with host org.yourapp.client containing the JUnit tests. The tests will be loaded with the plugin to be tested by the OSGi framework.
  • org.yourapp.server
  • org.yourapp.server.test
    • similar as above
  • org.yourapp.server.test.fragment
    • similar as above
  • org.yourapp.shared
  • org.yourapp.shared.test
    • similar as above
  • org.yourapp.shared.test.fragment
    • similar as above
  • org.yourapp.client.feature
  • org.yourapp.server.feature
  • org.yourapp.server.product
  • org.yourapp.ui.swing.product
  • org.yourapp.ui.swing
  • org.yourapp.parent
  • org.yourapp.target

[edit] Testing Server

[edit] Testing Shared

[edit] Testing Client

[edit] Debugging a Test

  • Add the "debugPort" to your pom.xml
<plugin>
	<groupId>org.eclipse.tycho</groupId>
		<artifactId>tycho-surefire-plugin</artifactId>
		<version>${tycho.version}</version>
		<configuration>
 		      <debugPort>18081</debugPort>
		</configuration>
</plugin>
  • Create a new Debug Configuration in Eclipse of type "Remote Java Application" (localhost:18081)
  • Tycho stops with "Listening for transport dt_socket at address: 18081"
  • At this point, Run your Debug Configuration

[edit] Advanced Topics

[edit] Support Rayo Look and Feel for Eclipse Scout

Add new P2-Repository with the corresponding Update Site URL

[edit] Support JDBC Drivers for Eclipse Scout

Add new P2-Repository with the corresponding Update Site URL

[edit] Integrate the JRE into the client zip

Extend the assembly.xml's fileSets definition:

<!-- integrate the JRE into the client zip -->
<fileSet>
  <directory>/path/to/jre</directory>
  <outputDirectory>/${product.finalName}/jre</outputDirectory>
</fileSet>

[edit] Bundle client and server together (to support direct client download)

Note.png
TODO
Add a description