xref: /aosp_15_r20/external/protobuf/java/core/pom.xml (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1<?xml version="1.0" encoding="UTF-8"?>
2<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/maven-v4_0_0.xsd">
3  <modelVersion>4.0.0</modelVersion>
4  <parent>
5    <groupId>com.google.protobuf</groupId>
6    <artifactId>protobuf-parent</artifactId>
7    <version>3.21.12</version>
8  </parent>
9
10  <artifactId>protobuf-java</artifactId>
11  <packaging>bundle</packaging>
12
13  <name>Protocol Buffers [Core]</name>
14  <description>
15    Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
16    efficient yet extensible format.
17  </description>
18
19  <dependencies>
20    <dependency>
21      <groupId>junit</groupId>
22      <artifactId>junit</artifactId>
23      <scope>test</scope>
24    </dependency>
25    <dependency>
26      <groupId>org.mockito</groupId>
27      <artifactId>mockito-core</artifactId>
28      <scope>test</scope>
29    </dependency>
30    <dependency>
31      <groupId>com.google.guava</groupId>
32      <artifactId>guava</artifactId>
33      <scope>test</scope>
34    </dependency>
35    <dependency>
36      <groupId>com.google.truth</groupId>
37      <artifactId>truth</artifactId>
38      <scope>test</scope>
39    </dependency>
40  </dependencies>
41
42  <build>
43    <!-- Include core protos in the bundle as resources -->
44    <resources>
45      <resource>
46        <directory>${protobuf.source.dir}</directory>
47        <includes>
48          <include>google/protobuf/any.proto</include>
49          <include>google/protobuf/api.proto</include>
50          <include>google/protobuf/descriptor.proto</include>
51          <include>google/protobuf/duration.proto</include>
52          <include>google/protobuf/empty.proto</include>
53          <include>google/protobuf/field_mask.proto</include>
54          <include>google/protobuf/source_context.proto</include>
55          <include>google/protobuf/struct.proto</include>
56          <include>google/protobuf/timestamp.proto</include>
57          <include>google/protobuf/type.proto</include>
58          <include>google/protobuf/wrappers.proto</include>
59          <include>google/protobuf/compiler/plugin.proto</include>
60        </includes>
61      </resource>
62    </resources>
63    <testResources>
64      <testResource>
65        <directory>${protobuf.source.dir}</directory>
66        <includes>
67          <include>google/protobuf/testdata/golden_message_oneof_implemented</include>
68          <include>google/protobuf/testdata/golden_packed_fields_message</include>
69        </includes>
70      </testResource>
71    </testResources>
72
73    <plugins>
74      <!-- Use Antrun plugin to generate sources with protoc -->
75      <plugin>
76        <artifactId>maven-antrun-plugin</artifactId>
77        <executions>
78          <!-- Generate core protos -->
79          <execution>
80            <id>generate-sources</id>
81            <phase>generate-sources</phase>
82            <configuration>
83              <target>
84                <ant antfile="generate-sources-build.xml"/>
85              </target>
86            </configuration>
87            <goals>
88              <goal>run</goal>
89            </goals>
90          </execution>
91
92          <!-- Generate the test protos -->
93          <execution>
94            <id>generate-test-sources</id>
95            <phase>generate-test-sources</phase>
96            <configuration>
97              <target>
98                <ant antfile="generate-test-sources-build.xml"/>
99              </target>
100            </configuration>
101            <goals>
102              <goal>run</goal>
103            </goals>
104          </execution>
105        </executions>
106      </plugin>
107
108      <!-- Add the generated sources to the build -->
109      <plugin>
110        <groupId>org.codehaus.mojo</groupId>
111        <artifactId>build-helper-maven-plugin</artifactId>
112        <executions>
113          <execution>
114            <id>add-generated-sources</id>
115            <phase>generate-sources</phase>
116            <goals>
117              <goal>add-source</goal>
118            </goals>
119            <configuration>
120              <sources>
121                <source>${generated.sources.dir}</source>
122              </sources>
123            </configuration>
124          </execution>
125          <execution>
126            <id>add-generated-test-sources</id>
127            <phase>generate-test-sources</phase>
128            <goals>
129              <goal>add-test-source</goal>
130            </goals>
131            <configuration>
132              <sources>
133                <source>${generated.testsources.dir}</source>
134              </sources>
135            </configuration>
136          </execution>
137        </executions>
138      </plugin>
139
140      <!-- OSGI bundle configuration -->
141      <plugin>
142        <groupId>org.apache.felix</groupId>
143        <artifactId>maven-bundle-plugin</artifactId>
144        <extensions>true</extensions>
145        <configuration>
146          <instructions>
147            <Automatic-Module-Name>com.google.protobuf</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
148            <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
149            <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
150            <Export-Package>com.google.protobuf;version=${project.version}</Export-Package>
151            <Import-Package>sun.misc;resolution:=optional,*</Import-Package>
152          </instructions>
153        </configuration>
154      </plugin>
155    </plugins>
156  </build>
157
158</project>
159