1

I have a application running in WebSphere liberty. Through mvn install command I need to deploy my application to liberty apps directory as I am not using dropins directory.

Bellow is the working maven plugin code from which I can deploy to dropins directory.

        <plugin>
            <groupId>net.wasdev.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>start-server</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start-server</goal>
                    </goals>
                    <configuration>
                        <verifyTimeout>60</verifyTimeout>
                    </configuration>
                </execution>
                <execution>
                    <id>deploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <serverHome>${wlp.dir}</serverHome>
                <serverName>${server}</serverName>
                <appArtifact>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>${project.artifactId}</artifactId>
                    <version>${project.version}</version>
                    <type>${project.packaging}</type>
                </appArtifact>
                <appDeployName>${project.artifactId}.${project.packaging}</appDeployName>
            </configuration>
        </plugin>

I couldn't find anywhere what configuration need to be added/change to deploy application directly to apps directory. Can someone please let me know what is missing here?

Charles
  • 4,372
  • 9
  • 41
  • 80
Roshanck
  • 2,220
  • 8
  • 41
  • 56
  • Based on the github repo doc (https://github.com/WASdev/ci.maven/blob/master/docs/deploy.md#deploy) it sounds like it's only possible to deploy to `dropins`. Why do you need to deploy to the `apps` directory instead of `dropins`? Shared lib or something? – Andy Guibert May 24 '17 at 03:50
  • Yes. I cannot have shared lib and it cause some issues in my application. Therefore I have no choice but to go with apps directory – Roshanck May 24 '17 at 03:55
  • You can apply shared libs to "dropin apps" by putting jars in this location: `${shared.config.dir}/lib/global` or `${server.config.dir}/lib/global`. See this doc: https://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/cwlp_sharedlibrary.html – Andy Guibert May 24 '17 at 04:07
  • I was using ${shared.config.dir}/lib/global until I hit the error oracle/sql/ArrayDescriptor. It was causing from ojdbc6.jar. Once I put application in apps folder and assigned libs dir configuration to application manually in server.xml and use the same libs dir configuration in server.xml for creating the dataSource, issue resolved. – Roshanck May 24 '17 at 04:27

2 Answers2

1

Adding install-apps execution step instead deploy(deploy execution step will deploy application to dropins folder only) step will resolve the issue. Version had to be updated to 1.3 which is the latest as of now

Ref : https://github.com/WASdev/ci.maven/blob/master/docs/install-apps.md

Full maven plugin code will be as bellow

<plugin>
        <groupId>net.wasdev.wlp.maven.plugins</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <id>start-server</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>start-server</goal>
                </goals>
                <configuration>
                    <verifyTimeout>60</verifyTimeout>
                </configuration>
            </execution>
            <execution>
                <id>install-apps</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>install-apps</goal>
                </goals>
                <configuration>
                    <appsDirectory>apps</appsDirectory>
                    <installAppPackages>project</installAppPackages>
                </configuration>
            </execution>
        </executions>
        <configuration>
            <serverHome>${wlp.dir}</serverHome>
            <serverName>${server}</serverName>
            <appArtifact>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
                <type>${project.packaging}</type>
            </appArtifact>
            <appDeployName>${project.artifactId}.${project.packaging}</appDeployName>
        </configuration>
    </plugin>
Roshanck
  • 2,220
  • 8
  • 41
  • 56
0

You can also try the current 2.0-SNAPSHOT version of the plugin. Just include the parent pom and a little piece of configuration for the plugin. Version 2.0 will be released in early June.

If you don't want to include the parent pom, you can just copy the <pluginManagement/> section from the parent pom which contains the binding of the liberty-maven-plugin goals to the Maven default build lifecycle. See https://github.com/WASdev/ci.maven/blob/master/docs/parent-pom.md

<parent>
    <groupId>net.wasdev.wlp.maven.parent</groupId>
    <artifactId>liberty-maven-app-parent</artifactId>
    <version>2.0-SNAPSHOT</version>
</parent>

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/
        </url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/
        </url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
         </snapshots>
    </pluginRepository>
</pluginRepositories>

...

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        ...
        <plugin>
            <groupId>net.wasdev.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>2.0-SNAPSHOT</version>
            <configuration>
                <assemblyArtifact>
                    <groupId>com.ibm.websphere.appserver.runtime</groupId>
                    <artifactId>wlp-webProfile7</artifactId>
                    <version>17.0.0.1</version>
                    <type>zip</type>
                </assemblyArtifact>
                <serverName>${project.artifactId}Server</serverName>
                <configFile>src/main/liberty/config/server.xml</configFile>
            </configuration>
        </plugin>
    </plugins>

    ...
</build>
patricktiu
  • 51
  • 1