5

Windows XP で Maven プロジェクトを生成しようとしました。

次のフォルダーを作成しましたpom.xml

<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>selenium.web.driver</groupId>
    <artifactId>OMS_selenium_Test</artifactId>
    <version>1.0</version>

    <packaging>jar</packaging>
    <name>selenium_tests</name>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.0</version>
            <scope></scope>
        </dependency>
    </dependencies>
</project>

開いcmdてこのフォルダに入ります。

次のコマンドを実行します。

C:\Documents and Settings\Admintemp\maven_test>mvn archetype:generate -DgroupId=
selenium.web.driver -DartifactId=OMS_selenium_Test -Dversion=1.0-SNAPSHOT -Dinte
ractiveMode=false

このデータでプロジェクトを生成する代わりに、次のエラーをキャッチしました:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.2:generate (default-cli) on project OMS_selenium_Test: Unable to add module to
the current project as it is not of packaging type 'pom' -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

なぜこれが正確に起こるのですか?smtが恋しいかもしれませんが、正確にはわかりません...

  • この問題を解決し、maven でプロジェクトを生成するにはどうすればよいですか?
4

3 に答える 3

9

あなたの間違いは、手動で POM ファイルを作成したことです。試行したコマンドを実行すると、Maven はこれを自動的に行います。POM ファイルを削除して、コマンドを再実行してみてください。

Maven は、既存の Maven プロジェクトにサブモジュールを追加したいと考えていました。これは、既存の POM ファイルが「pom」プロジェクトを予期していたときに「jar」プロジェクト (通常の Java コードなど) であったため、失敗しました。

于 2013-10-23T11:46:45.907 に答える