My Project structure like this:
opm-common: |_opm-api: |_opm-portal:
These are opm file:
opm-common
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.chick</groupId>
<artifactId>opm-common</artifactId>
<packaging>war</packaging>
<version>0.1.1</version>
<name>Online Project Management Common</name>
<properties>
<spring.version>4.3.2.RELEASE</spring.version>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.7.3</jackson.version>
<log4j.version>1.2.17</log4j.version>
<joda-time.version>2.9.4</joda-time.version>
<spring-data>1.9.2.RELEASE</spring-data>
</properties>
...
<build>
<finalName>opm-common</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
opm-api
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.chick</groupId>
<artifactId>opm-api</artifactId>
<packaging>war</packaging>
<version>0.1.1</version>
<name>Online Project Management API</name>
<properties>
<opm.common.version>0.1.1</opm.common.version>
<jdk.version>1.8</jdk.version>
<hibernate.version>5.1.0.Final</hibernate.version>
<servlet-api.version>3.1.0</servlet-api.version>
<mysql.version>5.1.37</mysql.version>
<mongo.version>3.2.2</mongo.version>
</properties>
<dependencies>
<!-- OPM dependencies -->
<dependency>
<groupId>com.chick</groupId>
<artifactId>opm-common</artifactId>
<version>${opm.common.version}</version>
</dependency>
...
</dependencies>
<build>
<finalName>opm-api</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestEntries>
<Dependencies>com.chick.opm-common</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>openshift</id>
<build>
<finalName>opm-api</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
<warName>opm-api</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
When build ... everything seems to be good. But when i run server to deploy opm-api ... it cann't create been (class in opm-common)
Below is servlet-context.xml (in opm-api)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan
base-package="com.chick.opm.common.model,com.chick.opm.common.service, com.chick.opm.api.controller, com.chick.opm.dao, com.chick.opm.api.service" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!-- Service Common -->
<bean id="ResponeMessageService" class="com.chick.opm.common.service.iml.ResponeMessageServiceImpl"></bean>
<bean id="ConstantService" class="com.chick.opm.common.service.iml.ConstantService"></bean>
<bean id="RouterService" class="com.chick.opm.common.service.iml.RouterService"></bean>
<!-- Service -->
<bean id="CollectionService" class="com.chick.opm.api.service.partial.CollectionService"></bean>
<bean id="CommonService" class="com.chick.opm.api.service.common.CommonService"></bean>
<!-- DAO -->
<bean id="CollectionDAO" class="com.chick.opm.api.dao.CollectionDAO"></bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
</beans>
Below is jboss-deployment-structure.xml (in opm-api)
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<sub-deployment name="opm-common-0.1.1.war">
<dependencies>
<module name="deployment.opm-common.war"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Below is Error when deploy (have jboss-deployment-structure.xml )
11:40:39,668 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."opm-api.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."opm-api.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "opm-api.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0166: Sub deployment opm-common-0.1.1.war in jboss-deployment-structure.xml was not found. Available sub deployments:
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:288)
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:190)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
11:40:39,985 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "opm-api.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"opm-api.war\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"opm-api.war\".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment \"opm-api.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0166: Sub deployment opm-common-0.1.1.war in jboss-deployment-structure.xml was not found. Available sub deployments: "}}
11:40:42,455 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "opm-api.war" (runtime-name : "opm-api.war")
11:40:42,455 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."opm-api.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."opm-api.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "opm-api.war"