Skip to content

Commit c8326bf

Browse files
authored
Adds CI test for mvn dependency:analyze and fixes missing deps (#738)
* Add Kokoro CI config for testing for dependency declarations * Fix missing and unused dependencies * Fix used dependency which is only used for javadocs * Ignore appengine-api-stubs test dependency
1 parent 5e191de commit c8326bf

File tree

9 files changed

+82
-29
lines changed

9 files changed

+82
-29
lines changed

.kokoro/dependencies.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Copyright 2019 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
cd github/google-http-java-client/
19+
20+
# Print out Java
21+
java -version
22+
echo $JOB_TYPE
23+
24+
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"
25+
26+
mvn install -DskipTests=true -B -V
27+
mvn -B dependency:analyze -DfailOnWarning=true

.kokoro/presubmit/dependencies.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
7+
}
8+
9+
env_vars: {
10+
key: "TRAMPOLINE_BUILD_FILE"
11+
value: "github/google-http-java-client/.kokoro/dependencies.sh"
12+
}

google-http-client-apache-v2/pom.xml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<configuration>
1919
<links>
2020
<link>https://download.oracle.com/javase/7/docs/api/</link>
21-
<link>https://jar-download.com/artifacts/org.codehaus.jackson/jackson-core-asl/${project.jackson-core-asl.version}/documentation</link>
2221
</links>
2322
<doctitle>${project.name} ${project.version}</doctitle>
2423
<windowtitle>${project.artifactId} ${project.version}</windowtitle>
@@ -87,24 +86,18 @@
8786
<groupId>com.google.http-client</groupId>
8887
<artifactId>google-http-client</artifactId>
8988
</dependency>
90-
<dependency>
91-
<groupId>com.google.http-client</groupId>
92-
<artifactId>google-http-client-test</artifactId>
93-
<scope>test</scope>
94-
</dependency>
9589
<dependency>
9690
<groupId>junit</groupId>
9791
<artifactId>junit</artifactId>
9892
<scope>test</scope>
9993
</dependency>
10094
<dependency>
101-
<groupId>com.google.guava</groupId>
102-
<artifactId>guava</artifactId>
103-
<scope>test</scope>
95+
<groupId>org.apache.httpcomponents</groupId>
96+
<artifactId>httpclient</artifactId>
10497
</dependency>
10598
<dependency>
10699
<groupId>org.apache.httpcomponents</groupId>
107-
<artifactId>httpclient</artifactId>
100+
<artifactId>httpcore</artifactId>
108101
</dependency>
109102
<dependency>
110103
<groupId>org.mockito</groupId>

google-http-client-appengine/pom.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
</signature>
4949
</configuration>
5050
</plugin>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-dependency-plugin</artifactId>
54+
<configuration>
55+
<!-- This artifact is needed by appengine-testing, but is not declared as a dependency -->
56+
<ignoredUnusedDeclaredDependencies>com.google.appengine:appengine-api-stubs</ignoredUnusedDeclaredDependencies>
57+
</configuration>
58+
</plugin>
5159
</plugins>
5260
</build>
5361
<dependencies>
@@ -80,10 +88,5 @@
8088
<artifactId>junit</artifactId>
8189
<scope>test</scope>
8290
</dependency>
83-
<dependency>
84-
<groupId>com.google.guava</groupId>
85-
<artifactId>guava</artifactId>
86-
<scope>test</scope>
87-
</dependency>
8891
</dependencies>
8992
</project>

google-http-client-findbugs/pom.xml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@
3232
<skip>true</skip>
3333
</configuration>
3434
</plugin>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-dependency-plugin</artifactId>
38+
<configuration>
39+
<!-- This is needed for Javadoc linking, but is not used in the compiled bytecode -->
40+
<ignoredUnusedDeclaredDependencies>com.google.http-client:google-http-client</ignoredUnusedDeclaredDependencies>
41+
</configuration>
42+
</plugin>
3543
</plugins>
3644
</build>
3745
<dependencies>
38-
<dependency>
39-
<groupId>com.google.http-client</groupId>
40-
<artifactId>google-http-client</artifactId>
41-
</dependency>
4246
<dependency>
4347
<groupId>com.google.code.findbugs</groupId>
4448
<artifactId>findbugs</artifactId>
@@ -58,5 +62,14 @@
5862
</exclusion>
5963
</exclusions>
6064
</dependency>
65+
<dependency>
66+
<groupId>com.google.code.findbugs</groupId>
67+
<artifactId>bcel-findbugs</artifactId>
68+
<version>6.0</version>
69+
</dependency>
70+
<dependency>
71+
<groupId>com.google.http-client</groupId>
72+
<artifactId>google-http-client</artifactId>
73+
</dependency>
6174
</dependencies>
6275
</project>

google-http-client-gson/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
<artifactId>google-http-client-test</artifactId>
6868
<scope>test</scope>
6969
</dependency>
70-
<dependency>
71-
<groupId>junit</groupId>
72-
<artifactId>junit</artifactId>
73-
<scope>test</scope>
74-
</dependency>
7570
<dependency>
7671
<groupId>com.google.code.gson</groupId>
7772
<artifactId>gson</artifactId>

google-http-client-jackson2/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
<artifactId>google-http-client-test</artifactId>
6868
<scope>test</scope>
6969
</dependency>
70-
<dependency>
71-
<groupId>junit</groupId>
72-
<artifactId>junit</artifactId>
73-
<scope>test</scope>
74-
</dependency>
7570
<dependency>
7671
<groupId>com.fasterxml.jackson.core</groupId>
7772
<artifactId>jackson-core</artifactId>

google-http-client/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
<groupId>org.apache.httpcomponents</groupId>
7373
<artifactId>httpclient</artifactId>
7474
</dependency>
75+
<dependency>
76+
<groupId>org.apache.httpcomponents</groupId>
77+
<artifactId>httpcore</artifactId>
78+
</dependency>
7579
<dependency>
7680
<groupId>com.google.code.findbugs</groupId>
7781
<artifactId>jsr305</artifactId>

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@
147147
<artifactId>httpclient</artifactId>
148148
<version>${project.httpclient.version}</version>
149149
</dependency>
150+
<dependency>
151+
<groupId>org.apache.httpcomponents</groupId>
152+
<artifactId>httpcore</artifactId>
153+
<version>${project.httpcore.version}</version>
154+
</dependency>
150155
<dependency>
151156
<groupId>com.google.guava</groupId>
152157
<artifactId>guava</artifactId>
@@ -357,6 +362,11 @@
357362
<artifactId>maven-site-plugin</artifactId>
358363
<version>3.7.1</version>
359364
</plugin>
365+
<plugin>
366+
<groupId>org.apache.maven.plugins</groupId>
367+
<artifactId>maven-dependency-plugin</artifactId>
368+
<version>3.1.1</version>
369+
</plugin>
360370
</plugins>
361371
</pluginManagement>
362372
<plugins>
@@ -552,6 +562,7 @@
552562
<project.xpp3.version>1.1.4c</project.xpp3.version>
553563
<project.commons-logging.version>1.2</project.commons-logging.version>
554564
<project.httpclient.version>4.5.9</project.httpclient.version>
565+
<project.httpcore.version>4.4.11</project.httpcore.version>
555566
<project.opencensus.version>0.21.0</project.opencensus.version>
556567
<project.root-directory>..</project.root-directory>
557568
<deploy.autorelease>false</deploy.autorelease>

0 commit comments

Comments
 (0)