0
サーブレット用の単体テストを作成しようとしています。明らかにビルドプロセスに影響を与えるmaven(私は思う)にはいくつかの問題があります。プロジェクトのクラスパステストでjava ee apiが見つからない
私はいくつかの研究を行い、明らかにこれは既知の問題です。 pom.xmlのjavaee-web-api依存関係の場所を変更することです。
残念なことに、このソリューションは私のためには機能しません。これはコーディングよりも構成に多くの時間を費やしているので、非常に不満です。
この問題を解決するにはどうすればよいでしょうか、あるいはテストのための他の解決策がありますか?
私はmavenとNetBeansを使用しています。
はorg.glassfish.extras依存関係がそれを解決するための追加
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
提供手段、おそらくあなたの代わりにテストを使用したいですか? –
あなたはエラーを投稿できますか?あなたのプロジェクトDynamic Web Moduleのバージョンは何ですか? – Fabio
6.0の 'javax/javaee- *'アーチファクトはこの問題で有名です。コンパイルには問題ありませんが、実行時に使用するために必要なコンテンツは削除されています。 –