もう1つの方法は、ソースに含まれるpom.xmlを編集することです。ライフサイクルの検証時にprotoファイルをコンパイルし、ソースディレクトリに書き込むことができます。
この差分または類似の適用(または新しいビルドのプロファイルを作成):今すぐ
$ diff -u ~/Downloads/protobuf-2.6.0/java/pom.xml pom.xml
--- /c/Users/MYNAME/Downloads/protobuf-2.6.0/java/pom.xml Mon Aug 25 20:52:36 2014
+++ pom.xml Tue Dec 2 13:51:56 2014
@@ -74,12 +74,12 @@
<executions>
<execution>
<id>generate-sources</id>
- <phase>generate-sources</phase>
+ <phase>validate</phase>
<configuration>
<tasks>
<mkdir dir="target/generated-sources" />
- <exec executable="../src/protoc">
- <arg value="--java_out=target/generated-sources" />
+ <exec executable="protoc">
+ <arg value="--java_out=src/main/java" />
<arg value="--proto_path=../src" />
<arg value="../src/google/protobuf/descriptor.proto" />
</exec>
@@ -92,12 +92,12 @@
</execution>
<execution>
<id>generate-test-sources</id>
- <phase>generate-test-sources</phase>
+ <phase>validate</phase>
<configuration>
<tasks>
<mkdir dir="target/generated-test-sources" />
- <exec executable="../src/protoc">
- <arg value="--java_out=target/generated-test-sources" />
+ <exec executable="protoc">
+ <arg value="--java_out=src/test/java" />
<arg value="--proto_path=../src" />
<arg value="--proto_path=src/test/java" />
<arg value="../src/google/protobuf/unittest.proto" />
、あなただけmvn validate
を実行することができますし、すべてのプロト・ファイルには、プロジェクトのソースにコンパイルされます:)
出典
2014-12-02 13:59:37
doc
READMEは本当にそれを明確にすることはできませんでした:* JavaまたはPythonランタイムライブラリを入手するためには、まだソースコードパッケージをダウンロードする必要があります。それを入手する: https://github.com/google/protobuf/releases/* –