<protoc.command>/opt/protobuf-2.1.0/bin/protoc</protoc.command>
<java.out>${basedir}/src/main/java</java.out>
<source.proto.dir>src/main/protobuf/proto/*.proto</source.proto.dir>

 <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <delete dir="${java.out}"/>
                                <mkdir dir="${java.out}"/>
                                <exec executable="${protoc.command}">
                                    <arg value="--java_out=$
{java.out}"/>
                                    <arg value="${source.proto.dir}"/>
                                </exec>
                            </tasks>
                            <sourceRoot>${java.out}</sourceRoot>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

Result:
[INFO] Executing tasks
[delete] Deleting directory /opt/TeamCity-4.5.1/buildAgent/work/
6520ea265be6b8b0/proto-api/src/main/java
[mkdir] Created dir: /opt/TeamCity-4.5.1/buildAgent/work/
6520ea265be6b8b0/proto-api/src/main/java
[exec] src/main/protobuf/proto/*.proto: No such file or directory
[exec] Result: 1
[INFO] Executed tasks

-----
The script is working just such a configuration:
<protoc.command>/opt/protobuf-2.1.0/bin/protoc</protoc.command>
<java.out>${basedir}/src/main/java</java.out>
<source.proto.dir>src/main/protobuf/x2c/proto/</source.proto.dir>
<plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <delete dir="${java.out}"/>
                                <mkdir dir="${java.out}"/>
                                <exec dir="${source.proto.dir}"
executable="${protoc.command}">
                                    <arg value="--java_out=$
{java.out}"/>
                                    <arg value="blabla.proto"/>
                                     <!--enumeration of all the proto
files-->
                                    <arg value="blabla.proto"/>
                                </exec>
                            </tasks>
                            <sourceRoot>${java.out}</sourceRoot>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

Under windows it works perfectly and the first and second option.
There is a better solution? that would get the first option.
OS: Ubuntu 9.04 and Windows XP SP3

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to