Hi,
I was searching if there are any existing plugins which will ,
create proto files from the message files given the location and
stumbled across this .
http://groups.google.com/group/protobuf/browse_thread/thread/e3982ec04d23a0e3
What is the outcome of this discussion, is the plugin ready to be
used??? if so where is t and how do I use it. Right now Iam using some
thing like thsi in my pom file:
----- snip---
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="target/generated-sources"/>
<exec executable="protoc">
<arg value="--java_out=target/
generated-sources"/>
<arg value="src/main/protobuf/
test.proto"/>
</exec>
</tasks>
<sourceRoot>target/generated-sources</
sourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
-------snip---
However I get copilation errors when I run mvn package.
---snip--
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure
C:\_home\ProtocolBufferTest\target\generated-sources\com\example
\tutorial\generated\AddressBookWithAddressProtos.java:[35,8] ';'
expected
C:\_home\ProtocolBufferTest\target\generated-sources\com\example
\tutorial\generated\AddressBookWithAddressProtos.java:[240,54]
generics are not suppor
ted in -source 1.3
(try -source 1.5 to enable generics)
com.google.protobuf.GeneratedMessage.Builder<Builder> {
C:\_home\ProtocolBufferTest\target\generated-sources\com\example
\tutorial\generated\AddressBookWithAddressProtos.java:[906,98] for-
each loops are not
supported in -source 1.3
(try -source 1.5 to enable for-each loops)
for
(com.example.tutorial.generated.AddressBookWithAddressProtos.Person.PhoneNumber
element : getPhoneList()) {
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:560)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:480)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:459)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:311)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced
(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode
(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException:
Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute
(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute
(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:443)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:539)
... 16 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Sep 30 13:31:55 EDT 2009
[INFO] Final Memory: 5M/10M
[INFO]
------------------------------------------------------------------------
---snip---
Any help is highly aprecaited, please guide me through this.