我的项目结构如下:
OPM-共同: | _opm-API: | _opm门户:
这些是opm文件:
OPM-共同
SKSpriteNode
OPM-API
Timer
构建时......一切似乎都很好。 但是当我运行服务器来部署opm-api时...它无法创建(opm-common中的类)
下面是servlet-context.xml(在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-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>
下面是jboss-deployment-structure.xml(在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>
部署时出现以下错误(有jboss-deployment-structure.xml)
<?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>