mvn eclipse:eclipse
コマンドを使用して my .project
andを生成してい.classpath
ます。
しかし、何らかの理由で、ファイルに 1 行追加したいと考えてい.classpath
ます。pom.xml
それを達成するために使用できる設定はありますか?
<additionalConfig>
の内容が消去されるため、 は使用できません.classpath
。
私はmaven 3.0.2とmaven-eclipse-plugin 2.8を使用しています。
mvn eclipse:eclipse
コマンドを使用して my .project
andを生成してい.classpath
ます。
しかし、何らかの理由で、ファイルに 1 行追加したいと考えてい.classpath
ます。pom.xml
それを達成するために使用できる設定はありますか?
<additionalConfig>
の内容が消去されるため、 は使用できません.classpath
。
私はmaven 3.0.2とmaven-eclipse-plugin 2.8を使用しています。
それはその行が何であるかによって異なります。
generate-sources
。これは、Eclipse プラグインによって自動的に取得されます。出力フォルダーを (別のものからtarget/classes
、またはtarget/test-classes
別のものに) 変更する場合は、maven ビルド構成でそれらを変更します。
<build>
<!-- replace "target" -->
<directory>somedir</directory>
<!-- replace "target/classes" -->
<outputDirectory>anotherdir</outputDirectory>
<!-- replace "target/test-classes" -->
<testOutputDirectory>yetanotherdir</testOutputDirectory>
</build>
これら 3 つのそれぞれを個別に構成でき、変更はEclipseプラグインによって取得されますが、outputDirectory
(通常は を参照することによって) を挿入することをお勧めします。testOutputDirectory
directory
${project.build.directory}
mvn clean
${project.build.directory}
<build>
<directory>bin</directory>
<outputDirectory>${project.build.directory}/main-classes
</outputDirectory>
<!-- this config will replace "target" with "bin",
compile src/main/java to "bin/main-classes"
and compile src/test/java to "bin/test-classes"
(because the default config for <testOutputDirectory> is
${project.build.directory}/test-classes )
-->
</build>
参照:
更新:あなたの場合、唯一可能な解決策は、プログラムでファイルを編集することだと思い.classpath
ます。私がおそらく行うことは、次のようなものです。
<profile>
名前付きの日食(または何でも)を定義しますgenerate-resources
)<file><exists>${project.basedir}/.classpath</exists></file>
(Eclipse プロジェクトでのみアクティブにしたいため)このソリューションの問題点eclipse:eclipse
は、フェーズではなく目標であるため、これを自動的に実行することはできないため、次のようにする必要があります。
mvn eclipse:eclipse # two separate executions
mvn generate-resources # here, profile will be active
またはおそらくこれも機能します:
mvn -Peclipse eclipse:eclipse generate-resources