Add deploy profiles for standalone wildfly using cargo plugin and for runtime installed instance

This commit is contained in:
Alex Theedom 2017-01-04 22:42:19 +01:00
parent 2fd130e24b
commit d1c2e042ce
4 changed files with 170 additions and 107 deletions

View File

@ -10,6 +10,12 @@
<artifactId>ejb-client</artifactId> <artifactId>ejb-client</artifactId>
<name>EJB3 Client Maven</name> <name>EJB3 Client Maven</name>
<description>EJB3 Client Maven</description> <description>EJB3 Client Maven</description>
<properties>
<junit.version>4.12</junit.version>
<maven-surefire-plugin.version>2.19</maven-surefire-plugin.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>org.wildfly</groupId>

View File

@ -1,16 +1,18 @@
package com.baeldung.ejb.setup.test; package com.baeldung.ejb.setup.test;
import static org.junit.Assert.*;
import org.junit.Test;
import com.baeldung.ejb.client.EJBClient; import com.baeldung.ejb.client.EJBClient;
import com.baeldung.ejb.tutorial.HelloWorldBean; import com.baeldung.ejb.tutorial.HelloWorldBean;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class EJBSetupTest { public class EJBSetupTest {
@Test @Test
public void testEJBClient() { public void EJBClientTest() {
EJBClient ejbClient = new EJBClient(); EJBClient ejbClient = new EJBClient();
HelloWorldBean bean = new HelloWorldBean(); HelloWorldBean bean = new HelloWorldBean();
assertEquals(bean.getHelloWorld(), ejbClient.getEJBRemoteMessage()); assertEquals(bean.getHelloWorld(), ejbClient.getEJBRemoteMessage());
} }
} }

View File

@ -1,40 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.baeldung.ejb</groupId>
<artifactId>ejb</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ejb-remote</artifactId>
<packaging>ejb</packaging>
<!-- <name>ejb-remote</name> --> <parent>
<dependencies> <groupId>com.baeldung.ejb</groupId>
<dependency> <artifactId>ejb</artifactId>
<groupId>javax</groupId> <version>1.0-SNAPSHOT</version>
<artifactId>javaee-api</artifactId> </parent>
<version>7.0</version>
<scope>provided</scope> <artifactId>ejb-remote</artifactId>
</dependency> <packaging>ejb</packaging>
</dependencies>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<!-- mvn clean package cargo:run -->
<profile>
<id>wildfly-standalone</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo-maven2-plugin.version}</version>
<configuration>
<container>
<containerId>wildfly10x</containerId>
<zipUrlInstaller>
<url>http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip</url>
</zipUrlInstaller>
</container>
<configuration>
<properties>
<cargo.hostname>127.0.0.1</cargo.hostname>
<cargo.jboss.management-http.port>9990</cargo.jboss.management-http.port>
<cargo.servlet.users>testUser:admin1234!</cargo.servlet.users>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!--mvn clean install wildfly:deploy -Pwildfly-runtime-->
<profile>
<id>wildfly-runtime</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha5</version>
<configuration>
<hostname>127.0.0.1</hostname>
<port>9990</port>
<username>testUser</username>
<password>admin1234!</password>
<filename>${build.finalName}.jar</filename>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<javaee-api.version>7.0</javaee-api.version>
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha5</version>
<configuration>
<hostname>127.0.0.1</hostname>
<port>9990</port>
<username>testUser</username>
<password>admin1234!</password>
<filename>${build.finalName}.jar</filename>
</configuration>
</plugin>
</plugins>
<!-- <finalName>ejb-remote</finalName> -->
</build>
</project> </project>

View File

@ -1,79 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.ejb</groupId> <groupId>com.baeldung.ejb</groupId>
<artifactId>ejb</artifactId> <artifactId>ejb</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>ejb</name> <name>ejb</name>
<description>EJB Tutorial</description> <description>EJB Tutorial</description>
<repositories> <repositories>
<repository> <repository>
<id>jboss-public-repository-group</id> <id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name> <name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url> <url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout> <layout>default</layout>
<releases> <releases>
<enabled>true</enabled> <enabled>true</enabled>
<updatePolicy>never</updatePolicy> <updatePolicy>never</updatePolicy>
</releases> </releases>
<snapshots> <snapshots>
<enabled>true</enabled> <enabled>true</enabled>
<updatePolicy>never</updatePolicy> <updatePolicy>never</updatePolicy>
</snapshots> </snapshots>
</repository> </repository>
</repositories> </repositories>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.baeldung.ejb</groupId> <groupId>com.baeldung.ejb</groupId>
<artifactId>ejb-remote</artifactId> <artifactId>ejb-remote</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>ejb</type> <type>ejb</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-api</artifactId> <artifactId>javaee-api</artifactId>
<version>7.0</version> <version>7.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wildfly</groupId> <groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId> <artifactId>wildfly-ejb-client-bom</artifactId>
<version>10.1.0.Final</version> <version>10.1.0.Final</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-ejb-plugin</artifactId> <artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version> <version>2.4</version>
<configuration> <configuration>
<ejbVersion>3.2</ejbVersion> <ejbVersion>3.2</ejbVersion>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
<modules> <modules>
<module>ejb-remote</module> <module>ejb-remote</module>