LSPS documentation logo
LSPS Documentation
Build

The LSPS Application build is a standard maven build and as such you can manage all its dependencies.

Once you have adapted the build, you can test it on SDK Embedded Server. For deployment to other servers, build the application EAR.

Building and Deploying LSPS Application during Development

To simplify the deployment during development of the LSPS Application, the SDK comes with SDK Embedded Server and its launcher: the launcher is created when you generate the LSPS Application along with the Maven build configuration for the application build. The launcher runs SDK Embedded Server with an exploded deployment of your application on its classpath: The configuration runs the main() method in the <APP_PACKAGE>.embedded.LSPSLauncher class.

Important: SDK Embedded Server is a different server from PDS Embedded Server.

You can run the server with the application in normal or debug mode:

  • When launched in debug mode, changes in the source code of the application are reflected immediately.
  • When launched in normal mode, changes are reflected after re-build the application, and restart of the Embedded server.

Hence to build your application and run it on SDK Embedded Server, do the following:

  1. Build the application: Right-click the maven build launcher configuration in the <YOUR_APP>-embedded project and select Run As > <YOUR_APP> Maven Build.
    mavenBuildConfigurationRun.png

    Note: Next time build the application from the Run menu or from the drop-down of the Run icon on the toolbar.

  2. Run SDK Embedded Server with the application to check your customizations: Right-click the Embedded Server Launcher configuration in the <YOUR_APP>-embedded project and select Run As > <YOUR_APP> Embedded Server Launcher.

    Note: Next time run the application server from the Run menu or from the drop-down of the Run icon on the toolbar.

jettyConfigRun.png
Running the application with the generated launcher

Building the LSPS Application EAR

To build the application EAR so you can deploy it on a supported application server, run mvn clean install in the directory with the root pom.xml. Consider running the build with the provided tests with mvn clean install -Dlsps.tester. The tester package includes various checks, including a check of the ear content against the dependencies in the jboss-deployment-structure.xml.

Important: When preparing LSPS Application EAR for production environment, disable the form preview feature from the application: Create a custom application navigator class that extends DefaultAppNavigator and override its addAllViews() method:

public class AppAppNavigator extends DefaultAppNavigator {
 public AppAppNavigator(UI ui, ViewDisplay display) {
   super(ui, display);
 }
 @Override
 protected void addAllViews() {
   addView(todoListViewId(), todoListViewClass());
   addView(documentsViewId(), documentsViewClass());
   addView(runModelViewId(), runModelViewClass());
   addView(appSettingsViewId(), appSettingsViewClass());
   addView(todoViewId(), todoViewClass());
   addView(documentViewId(), documentViewClass());
   //remove this:
   //addView(formPreviewId(), formPreviewViewClass());
 }
}

Make your LspsUI class (typically AppLspsUI), use this navigator: override the createNavigator method:


 @Override
 protected void createNavigator(ViewDisplay display) {
   Navigator navigator = new AppAppNavigator(getUI(), display);
   navigator.addViewChangeListener(new PageTitleFromAppView());
}

The output EAR file is located in the target directory. To deploy follow the deployment instructions for your server.

Dependency Management

Adding a Module in the Build

To export a module into a deployable zip file as part of your Maven build use ModelExporter: ModelExporter exports the module with all imported modules and their dependencies including the Standard Library Modules.

To integrate the export in your Maven build include the plug-in in your pom.xml:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
  <executions>
    <execution>
      <goals>
        <goal>java</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <mainClass>com.whitestein.lsps.export.ModelExporter</mainClass>
    <arguments>
      <argument>d:\CustomerModule</argument>
      <argument>processes\Main</argument>
      <argument>d:\CustomerProject\target\stdlib</argument>
      <argument>d:\result.zip</argument>
    </arguments>
  </configuration>
</plugin>

Your can then use the resulting zip file as input for the uploadModel in your pom.xml:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
  <executions>
    <execution>
      <id>uploadModel</id>
      <goals>
        <goal>java</goal>
      </goals>
      <phase>deploy</phase>
      <configuration>
        <mainClass>com.whitestein.lsps.mconsolecl.Main</mainClass>
        <arguments>
          <argument>modelUpload</argument>
          <argument>-h</argument>
          <argument>${modelUpload.host}</argument>
          <argument>-u</argument>
          <argument>${modelUpload.user}</argument>
          <argument>-p</argument>
          <argument>${modelUpload.password}</argument>
          <!-- The output file of the ModelExporter run:-->
          <argument>-m</argument>
          <argument>d:\result.zip</argument>
          <argument>--dbUpdateStrategy</argument>
          <argument>${modelUpload.dbUpdateStrategy}</argument>
        </arguments>
      </configuration>
    </execution>
  </executions>
</plugin>

Adding Dependencies

If you plan to use libraries that are not imported by default, add them to the application pom.xml as dependencies, so they are included by maven automatically, and compile the application:

  1. Add the library as a dependency to pom.xml of the respective project, typically the pom.xml
    • in the <YOUR_APP>-ejb project when extending the LSPS Server with custom functions or task types
    • in the <YOUR_APP>-vaadin-war when implementing custom form or ui components
    • in the <YOUR_APP>-vaadin when implementing or extending Application User Interface features and components
  2. Define the dependency metadata with the dependency version in <dependencyManagement> of the main pom.xml.
  3. On the command line, go to the application root directory and rebuild the application: mvn clean eclipse:clean eclipse:eclipse install lsps:updateClasspath -DskipTests.
  4. Refresh the resources in PDS: select the resources in GO-BPMN Explorer, right-click the selection, and click Refresh.
pomwithnewdependency.png
New dependency in the application pom.xml

Removing Dependencies

To remove a webapp you do not need, such as Monitoring, from dependencies, do the following:

  • for production environments, remove the dependency form the respective pom.xml file, in the case of Monitoring from the pom.xml of the ear project.
  • for SDK Embedded Server, remove the dependency form the respective pom.xml file and the application line from the LSPSLauncher class in the embedded project.