2012-02-10 8 views
0

Eclipseのm2eプラグインをインストールして、単純なアーキタイプを作成しました。私は小さなテストドライバを書いて、プロジェクトを(Maven経由で)ビルドし、Javaソースをクラスファイルにコンパイルしようとしています。M2Eclipse(M2E)ビルドエラー

私はRun >> Run Configurationsに行き、New Maven Buildを作成します。名前を付けて、そのベースディレクトリをプロジェクトルートに設定します。

Goalsを選択しようとすると表示されないため、追加/指定できません。 Runボタンをクリックします。

[INFO] Scanning for projects... 
[ERROR] The build could not read 1 project -> [Help 1] 
[ERROR] 
[ERROR] The project org.me:myproject:0.0.1-SNAPSHOT (C:\Users\me\workbench\eclipse\workspace\MyProject\pom.xml) has 3 errors 
[ERROR]  'build.plugins.plugin.artifactId' is missing. @ line 145, column 17 
[ERROR]  'build.plugins.plugin.groupId' is missing. @ line 144, column 14 
[ERROR]  'build.plugins.plugin.version' for : must be a valid version but is ''. @ line 146, column 14 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[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 read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException 

私のpom.xmlで<build>タグは次のとおりです:

<build> 
    <plugins> 
     <plugin> 
      <groupId></groupId> 
      <artifactId></artifactId> 
      <version></version> 
      <executions> 
       <execution> 
        <phase>compile</phase> 
        <goals> 
         <goal>compiler:compile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

いくつかのこと:

  • artifactIdgroupIdversion場合はどうあるべきかをここでは私のコンソール出力でありますこれは(標準)Maven compileフェーズですか?
  • これはMavenビルドを起動する正しい方法ですか(Run Configurations)? Antには、build.xmlで定義されているすべてのターゲットを表示できるプラグインがあります。私はMaven/m2eでそのようなアナログは見ません。
  • なぜというコンパイルのプラグインが必要なのでしょうか?これはビルドツールの標準的な部分と考えられます。

答えて

1

mavenコンパイラのすべてのデフォルト設定を使用しているので、何も配置する必要はありません。本当に指定したい場合は、次のようにしてください:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>2.3.2</version> 
</plugin> 
+0

ありがとう! pom.xmlを再検査した後、上に貼り付けた ''要素の赤色で強調表示されたエラー(Eclipseによる)が表示されます。エラーは次のようになります:*ライフサイクル設定でカバーされていないプラグインの実行:org.apache.maven.plugins:maven-compiler-plugin:2.3.2:コンパイラ:コンパイル(実行:デフォルト、フェーズ:コンパイル)あなたが話していることとは何ですか?もしそうなら、救済は何ですか? – IAmYourFaja

+0

また、私がビルドを開始する方法に関して、これはEclipse内部から(実行コンフィギュレーションを通じて)Maven/m2eを呼び出す標準的な方法ですか? – IAmYourFaja

+0

何をしたいですか? Mavenは、ソースコードのビルドとパッケージ化に役立ちます。コンパイルはそのようなプロセスのほんの一歩です。さらに、このステップは、EclipseのEclipse Javaコンパイラによって実行されます。 Mavenユーザーのメーリングリストに詳細な質問を送ってください。 –