Maven多模块EAR文件的“未解决的编译问题”

时间:2011-01-21 22:33:40

标签: maven-2 maven maven-3

war模块中的JSP将无法编译,因为jar模块在编译时不在类路径中。

EAR模块依赖

  <dependencies>
  <dependency>
   <artifactId>rtuDataAccess</artifactId>
   <groupId>${project.groupId}</groupId>
   <version>${project.version}</version>
   <type>jar</type>
  </dependency>
  <dependency>
   <artifactId>rtu</artifactId>
   <groupId>${project.groupId}</groupId>
   <version>${project.version}</version>
   <type>war</type>
  </dependency>
  <dependency>
   <artifactId>rtuEformProcess</artifactId>
   <groupId>${project.groupId}</groupId>
   <version>${project.version}</version>
   <type>war</type>
  </dependency>

 </dependencies>

EAR插件设置

    <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.2</version>

<configuration>
    <defaultJavaBundleDir>lib/</defaultJavaBundleDir>
 <modules>
  <jarModule>
   <groupId>edu.mayo.lpea.lsa</groupId>
   <artifactId>rtuDataAccess</artifactId>
  </jarModule>

  <webModule>
   <groupId>edu.mayo.lpea.lsa</groupId>
   <artifactId>rtu</artifactId>
   <contextRoot>/lsa/rtu</contextRoot>
  </webModule>
  <webModule>
   <groupId>edu.mayo.lpea.lsa</groupId>
   <artifactId>rtuEformProcess</artifactId>
   <contextRoot>/lsa/rtuEformProcess</contextRoot>
  </webModule>
 </modules>
</configuration>

WAR插件(在战争模块中)

       <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
            <configuration>
                <warName>${project.artifactId}</warName>
                <ignoreWebxml>true</ignoreWebxml>
                <archive>
                   <manifest>
                       <classpathPrefix>lib/</classpathPrefix>
                       <addClasspath>true</addClasspath>
                   </manifest>
                </archive>
            </configuration>

0 个答案:

没有答案