Skip to content

Instantly share code, notes, and snippets.

@sergei-ivanov
Created February 2, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergei-ivanov/c56c0806ed36ec2ad709 to your computer and use it in GitHub Desktop.
Save sergei-ivanov/c56c0806ed36ec2ad709 to your computer and use it in GitHub Desktop.
sergei-ivanov/maven-protoc-plugin #22 corrected sample POM file
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.squareup.protos</groupId>
<artifactId>base</artifactId>
<description>A generic Square proto module.</description>
<version>HEAD-SNAPSHOT</version>
<packaging>jar</packaging>
<profiles>
<!-- Generate protos if present -->
<profile>
<id>generate-protos</id>
<activation>
<file>
<exists>src/main/proto</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<executions>
<execution>
<id>generate-protos</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/protos
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Generate test protos if present -->
<profile>
<id>generate-test-protos</id>
<activation>
<file>
<exists>src/test/proto</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<executions>
<execution>
<id>generate-test-protos</id>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-test-sources/protos
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<version>0.3.2</version>
<configuration>
<protocExecutable>/usr/local/bin/protoc</protocExecutable>
<checkStaleness>true</checkStaleness>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment