2 peter20091001 peter20091001 于 2017.09.07 11:50 提问

maven多模块依赖的问题

在父模块中的pom.xml文件中:

 <?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" 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>
  <groupId>com.zeus</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
    <name>school</name>
    <modules>
    <module>school-service</module>
    <module>school-web</module>
    </modules>
    <dependencyManagement>
        <dependencies>
            <dependency>  
                <groupId>junit</groupId>  
                <artifactId>junit</artifactId>  
                <version>4.12</version>  
                <scope>test</scope>  
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.0.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>
</project>

子模块pom.xml文件中也设置了

   <parent>
    <groupId>com.zeus</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>

为什么子模块中有jsp文件的地方还报错:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

3个回答

Small_Mouse0
Small_Mouse0   Ds   Rxr 2017.09.07 11:51

题主上传的内容 ,,,不太对头,,,,用代码框上传代码

 。。
congge_1993
congge_1993   2017.09.07 15:11

子pom本身就会依赖主pom中的jar包,为何还要引入项目jar呢?

weisheixiaoxin
weisheixiaoxin   2017.09.07 17:41

有没有安装到maven仓库 mvn install

Csdn user default icon
上传中...
上传图片
插入图片