0

Mavenを使用して、ファイルに新しいbuildCommandを追加する必要があり.projectます。

私の.projectファイル(Mavenによって作成されました):

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>myProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.maven.ide.eclipse.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>

次のbuildCommandを追加する必要があります。

<buildCommand>
        <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
        <triggers>auto,full,incremental,</triggers>
        <arguments>
            <dictionary>
                <key>LaunchConfigHandle</key>
                <value>&lt;project&gt;/.externalToolBuilders/myLuncher.launch</value>
            </dictionary>
        </arguments>
    </buildCommand>

誰かが私がこれをどのように行うことができるか考えていますか?

4

2 に答える 2

1

ドキュメントに基づいて、mavenpom.xmlファイルを更新できます。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>
  <version>2.9</version>
  <configuration>
    <additionalBuildcommands>
      <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
      <triggers>auto,full,incremental,</triggers>
      <arguments>
        <dictionary>     
          <key>LaunchConfigHandle</key>     
          <value>&lt;project&gt;/.externalToolBuilders/myLuncher.launch</value>
        </dictionary>
      </arguments>
    </additionalBuildcommands>
  </configuration>
</plugin>

次に、呼び出すmvn eclipse:eclipseと、追加した.projectファイルが再生成されますbuildCommand

于 2012-05-09T21:03:36.063 に答える
0

あなたの答えをありがとうアッティラ-私はそれを機能させるためにいくつかのマイナーな変更を加えました。あなたの投稿を編集しようとしましたが、編集が受け入れられませんでした...

私は次のようにプラグインを使用しました:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <additionalBuildcommands>
            <buildCommand>
                <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
                <triggers>auto,full,incremental,</triggers>
                <arguments>
                    <LaunchConfigHandle>
                    &lt;project&gt;/.externalToolBuilders/myLuncher.launch
                    </LaunchConfigHandle>
                </arguments>
            </buildCommand>
        </additionalBuildcommands>  
    </configuration>
</plugin>

eclipse:m2eclipseコマンドを使用してからm2eclipseプラグインでプロジェクトを使用できるようになったため、2.9ではなくバージョン2.7を使用しています。

于 2012-05-11T12:41:34.010 に答える