2013-06-28 50 views
12

私はapache mavenを使ってバンドルを作成しようとしています。私は私がいることを置く場所私のプロジェクトdependencies.dependency.version 'にエラーがありません

のリソースフォルダ内の「サーブレット-api.jarを」のいずれかの誰かが教えてくださいませんように配置している

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

:私はmvn clean installコマンドを実行すると、以下のエラーを与えています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

versionタグをdependencyに追加していません。

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

メッセージは非常に明確である:あなたのポンポンのdependencies要素内には、アーチファクトとdependency要素を持っているjavax.servlet:servlet-api.jar 。この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

私は2つのバージョン以外のすべてのバージョンを発見した1、私は上記のバージョンが正しいことを知っていた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> 

サブレベルポンポンが

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

葉ポンポンがFiに

<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-c​​an- i-do-代わりに)。 – Dwhitz

関連する問題