2013-06-28 5 views
12

apache maven을 사용하여 번들을 만들려고합니다. 나는 그것이 아래의 오류주고있다 mvn clean install 명령을 실행하면 : 내 프로젝트의 리소스 폴더 안에 그 '서블릿 - api.jar을'을 배치 한dependencies.dependency.version '에 오류가 없습니다.

dependencies.dependency.version' is missing for javax.servlet:servlet-api.jar

을 나는 것을 배치 할 위치

어떤 사람이 말해 주 시겠어요 항아리 파일? UPDATE

: 여기 내 pom.xml 파일입니다

<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"> 

<parent> 
    <artifactId>felix-parent</artifactId> 
    <groupId>org.apache.felix</groupId> 
    <version>2.1</version> 
    <relativePath>../pom/pom.xml</relativePath> 
</parent> 

<modelVersion>4.0.0</modelVersion> 

<artifactId>maven-bundle-plugin</artifactId> 
<version>2.4.1-SNAPSHOT</version> 
<packaging>maven-plugin</packaging> 

<name>Maven Bundle Plugin</name> 
<description> 
    Provides a maven plugin that supports creating an OSGi bundle 
    from the contents of the compilation classpath along with its 
    resources and dependencies. Plus a zillion other features. 
    The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd) 
</description> 

<scm> 
    <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</connection> 
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/bundleplugin</developerConnection> 
    <url>http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</url> 
</scm> 

<build> 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <configuration> 
    <source>1.5</source> 
    <target>1.5</target> 
    </configuration> 
    </plugin> 
    </plugins> 
</build> 

<dependencies> 
     <!-- Provided APIs --> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
     </dependency> 

    </dependencies> 

<reporting> 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-plugin-plugin</artifactId> 
    <version>3.2</version> 
    </plugin> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-changes-plugin</artifactId> 
    <version>2.9</version> 
    <configuration> 
    <component>12311143</component> 
    <versionPrefix>maven-bundle-plugin-</versionPrefix> 
    <statusIds>Resolved,Closed</statusIds> 
    <maxEntries>1000</maxEntries> 
    <issueManagementSystems> 
     <issueManagementSystem>JIRA</issueManagementSystem> 
    </issueManagementSystems> 
    <useJql>true</useJql> 
    </configuration> 
    </plugin> 
    </plugins> 
</reporting> 

</project> 

감사 앤더슨

+1

당신의 pom.xml을 보여주십시오. 분명히'''servlet-api'에 대해서는''을 놓쳤습니다. – LaurentG

+0

내 pom.xml을 찾으십시오 – user2532663

답변

13

dependencyversion 태그를 추가하지 않았습니다.

<dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>1.0.0</version> //Add the version. 
</dependency> 
1

메시지는 매우 분명하다 : 당신의 치어의 dependencies 요소 내에, 당신은 인공물 javax.servlet:servlet-api.jardependency 요소가 . 이 dependency 요소 안에는 버전 요소가 있어야하지만 제공하지 않았습니다.

<dependencies> 
    <!-- Provided APIs --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 

     <!-- missing version here: --> 
     <version>3.0</version> 
    </dependency> 
</dependencies> 

3.0은 단지 예일뿐입니다. 적합한 버전을 제공하십시오.

+0

고맙습니다. 사실 내 POM에는 20 가지 이상의 종속성이 있습니다. 나는 groupid, artifactId를 알고 있었다. 그러나 나는 버전을 정확하게 모른다. 포함 할 방법이 있습니까? – user2532663

+1

무엇을 포함 할 수 있습니까? 실제로 사용할 서블릿 API 버전을 알아야합니다. 아무도 당신을 추측 할 수 없습니다. –

+0

내가 두 버전을 제외한 모든 버전을 발견 한 나는 위의 버전이 올바른지 알고 com.day.cq CQ-공유지 \t 5.5.0 \t \t입니다. 그러나 그것을 찾을 수없는 수녀님. 그러나 대체 방법으로 으로 가져 오기 mvn deploy : deploy-file -DgroupId = com.day.cq -DartifactId = cq-commons -Dversion = 5.5.0 -Dpackaging = jar -Dfile =/path/to/file - Durl = [url] -DrepositoryId = [id] URL/path/to/file, id는 무엇입니까? 제발 나를 안내하십시오 – user2532663

2

나는 약간 다른 이유로이 같은 오류가있었습니다.

내 프로젝트는 종속성 관리 (어떤 이유로 2 <dependencyManagement> 섹션 있음)를 사용하며 많은 모듈과 하위 모듈을 사용합니다.

최고 수준 치어가 있었다 :

<dependencyManagement> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-core_2.10</artifactId> 
      <version>${spark.version}</version> 
     </dependency> 
    </dependencyManagement> 

하위 수준 치어는 Fi에

<dependencyManagement> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-core_2.10</artifactId> 
      <scope>provided</scope> 
     </dependency> 
    </dependencyManagement> 

잎 치어했다

<dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-core_2.10</artifactId> 
    </dependency> 

했다 X를 나는 중간 수준의 치어에서 <dependencyManagement> 부분을 제거하고 나는 하나의 치어를 내 경우

<dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-core_2.10</artifactId> 
     <scope>provided</scope> 
    </dependency> 
0

을 위해 잎 치어 변경과 같은 문제에 직면했다. 위의 해리의 대답에서 힌트를 얻으면, 나는 dependancymanagement 섹션을 추가하고 문제가 해결되었습니다.

+0

이것은 질문에 대한 답변을 제공하지 않으며, 코멘트 여야합니다. [언제 코멘트해야합니까?] (https://stackoverflow.com/help/privileges/comment)를 참조하십시오. [평판] (https://stackoverflow.com/help/whats-reputation)이 충분하면 모든 게시물에서 [comment] (https://stackoverflow.com/help/privileges/comment) 할 수 있습니다. 대신, [질문자의 설명이 필요없는 답변을 제공하십시오] (https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can- i-do- 대신). – Dwhitz