2014-02-25 51 views
0

我正在嘗試集中pom中的所有依賴項以消除冗餘。但是,當我試圖將javaee-web-api依賴關係置於一個集中位置時,它不會被我的servlet類EventManager.java解析。在子項目中引用pom jar

我的問題是:你可以把「提供」作用域的依賴項放在父pom中,並在子項目中引用它?

家長凸出

<dependencies> 
    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     <version>2.2.4</version> 
    </dependency> 
    <dependency> 
     <groupId>javax</groupId> 
     <artifactId>javaee-web-api</artifactId> 
     <version>6.0</version> 
     <scope>provided</scope> 
    </dependency>  
</dependencies>   

兒童凸出

<dependencies> 
    <dependency> 
     <groupId>com.study</groupId> 
     <artifactId>poc1</artifactId> 
     <version>1.0-SNAPSHOT</version> 
     <type>pom</type> 
    </dependency> 
</dependencies> 

EventManager.java(位於子項目)

package com.study.webstore.event.processor; 

import com.study.webstore.event.AnalyticsModel; 
import com.study.webstore.util.GenericUtils; 
import java.io.IOException; 
import javax.servlet.Filter; 
import javax.servlet.FilterChain; 
import javax.servlet.FilterConfig; 
import javax.servlet.ServletException; 
import javax.servlet.ServletRequest; 
import javax.servlet.ServletResponse; 
import javax.servlet.http.HttpServletRequest; 
import org.apache.log4j.Logger; 

public class EventManager implements Filter { 

    private static final Logger log = Logger.getLogger(EventManager.class); 

    //some more code 
+0

com.study:poc1是你的父項目? –

回答