示されているように、Maven Plugin を使用して Eclipse IDE で Web アプリケーションを作成しました。
そのプロジェクトでサーブレットを作成しました
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">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>MTest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>MTest Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>MTest</finalName>
</build>
</project>
pom.xml を右クリックして Run as Maven Install を実行すると
サーブレットのクラス ファイルが表示されませんでした
C:\Users\sai\OfficeWSApril14\MTest\target\MTest\WEB-INF\classes
その結果、そのスローClassNotFoundException
私が間違っていたことを教えてください
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MTest Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ MTest ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MTest ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ MTest ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\sai\OfficeWSApril14\MTest\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MTest ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.1:test (default-test) @ MTest ---
[INFO] Surefire report directory: C:\Users\sai\OfficeWSApril14\MTest\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ MTest ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MTest] in [C:\Users\sai\OfficeWSApril14\MTest\target\MTest]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\sai\OfficeWSApril14\MTest\src\main\webapp]
[INFO] Webapp assembled in [107 msecs]
[INFO] Building war: C:\Users\sai\OfficeWSApril14\MTest\target\MTest.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ MTest ---
[INFO] Installing C:\Users\sai\OfficeWSApril14\MTest\target\MTest.war to C:\Users\sai\.m2\repository\com\MTest\0.0.1-SNAPSHOT\MTest-0.0.1-SNAPSHOT.war
[INFO] Installing C:\Users\sai\OfficeWSApril14\MTest\pom.xml to C:\Users\sai\.m2\repository\com\MTest\0.0.1-SNAPSHOT\MTest-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.536s
[INFO] Finished at: Mon Apr 29 10:10:06 IST 2013
[INFO] Final Memory: 5M/15M
[INFO] ---------------------
Eclipse IDE Project create new Servlet を右クリック
すると、ソースファイルが src/main/java の下に配置されるようにするにはどうすればよいですか??
スクリーンショットを添付しましたので、ご覧ください