Skip to content

Commit 3e4726f

Browse files
authored
Merge pull request #335 from maxmind/greg/module
Make library a Java module and prepare for release
2 parents c0774c2 + ff2322a commit 3e4726f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1886
-1298
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ jobs:
1717
with:
1818
distribution: ${{ matrix.distribution }}
1919
java-version: ${{ matrix.version }}
20-
- run: mvn javadoc:javadoc
2120
- run: mvn test -B
21+
# This is after the test run to work around
22+
# https://issues.apache.org/jira/projects/MJAVADOC/issues/MJAVADOC-736
23+
- run: mvn javadoc:javadoc

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
4.0.0
55
------------------
66

7+
* This library is now a Java module.
78
* Added support for the GeoIP2 IP Risk database.
89

910
3.0.2 (2022-10-31)
@@ -136,8 +137,8 @@ CHANGELOG
136137
-------------------
137138

138139
* The following new anonymizer methods were added to
139-
`com.maxmind.geoip2.record.Traits` for use with GeoIP2 Precision Insights:
140-
`isAnonymous()`, `isAnonymousVpn()`, `isHostingProvider()`, `isPublicProxy()`,
140+
`com.maxmind.geoip2.record.Traits` for use with GeoIP2 Precision Insights:
141+
`isAnonymous()`, `isAnonymousVpn()`, `isHostingProvider()`, `isPublicProxy()`,
141142
and `isTorExitNode()`.
142143

143144
2.9.0 (2017-05-08)

README.dev.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Steps for releasing:
2323
4. Install or update [gh](https://github.com/cli/cli) as it used by the release script.
2424
5. Test that `mvn package` can complete successfully. Run `git clean -dxff`
2525
or something similar to clean up afterwards.
26-
5. Run `./dev-bin/release.sh`.
26+
6. Run `./dev-bin/release.sh`.
2727
* This will package the release, update the gh-pages branch, bump the
2828
version to the next development release, upload the release to GitHub
2929
and tag it, and upload to Sonatype.
3030
* It may prompt you about out of date dependencies. You should consider
3131
updating them if appropriate. Say no and review the changes and upate
3232
`pom.xml` and start the release process over again if you do.
33-
6. Complete the release on Sonatype
33+
7. Complete the release on Sonatype
3434

3535
There is more information in the
3636
[minfraud-api-java](https://github.com/maxmind/minfraud-api-java/blob/main/README.dev.md)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ object.
190190

191191
After you have created the `DatabaseReader`, you may then call one of the
192192
appropriate methods, e.g., `city` or `tryCity`, for your database. These
193-
methods take the IP address to be looked up. The methods with the `try`
193+
methods take the IP address to be looked up. The methods with the `try`
194194
prefix return an `Optional` object, which will be empty if the value is
195195
not present in the database. The method without the prefix will throw an
196196
`AddressNotFoundException` if the address is not in the database. If you
@@ -437,7 +437,8 @@ following:
437437

438438
* `com.maxmind.geoip2.record.City` - `City.getGeoNameId`
439439
* `com.maxmind.geoip2.record.Continent` - `Continent.getCode` or `Continent.getGeoNameId`
440-
* `com.maxmind.geoip2.record.Country` and `com.maxmind.geoip2.record.RepresentedCountry` - `Country.getIsoCode` or `Country.getGeoNameId`
440+
* `com.maxmind.geoip2.record.Country` and `com.maxmind.geoip2.record.RepresentedCountry` - `Country.getIsoCode`
441+
or `Country.getGeoNameId`
441442
* `com.maxmind.geoip2.record.Subdivision` - `Subdivision.getIsoCode` or `Subdivision.getGeoNameId`
442443

443444
## Multi-Threaded Use ##

checkstyle-suppressions.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_0.dtd">
6+
7+
<suppressions>
8+
</suppressions>

checkstyle.xml

Lines changed: 382 additions & 0 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?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/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>com.maxmind.geoip2</groupId>
56
<artifactId>geoip2</artifactId>
@@ -44,17 +45,17 @@
4445
<dependency>
4546
<groupId>com.fasterxml.jackson.core</groupId>
4647
<artifactId>jackson-databind</artifactId>
47-
<version>2.13.4.2</version>
48+
<version>2.14.1</version>
4849
</dependency>
4950
<dependency>
5051
<groupId>com.fasterxml.jackson.core</groupId>
5152
<artifactId>jackson-core</artifactId>
52-
<version>2.13.4</version>
53+
<version>2.14.1</version>
5354
</dependency>
5455
<dependency>
5556
<groupId>com.fasterxml.jackson.core</groupId>
5657
<artifactId>jackson-annotations</artifactId>
57-
<version>2.13.4</version>
58+
<version>2.14.1</version>
5859
</dependency>
5960
<dependency>
6061
<groupId>junit</groupId>
@@ -71,7 +72,7 @@
7172
<dependency>
7273
<groupId>com.fasterxml.jackson.jr</groupId>
7374
<artifactId>jackson-jr-objects</artifactId>
74-
<version>2.13.4</version>
75+
<version>2.14.1</version>
7576
<scope>test</scope>
7677
</dependency>
7778
<dependency>
@@ -92,6 +93,33 @@
9293
</properties>
9394
<build>
9495
<plugins>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-checkstyle-plugin</artifactId>
99+
<version>3.2.0</version>
100+
<configuration>
101+
<consoleOutput>true</consoleOutput>
102+
<configLocation>checkstyle.xml</configLocation>
103+
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
104+
<violationSeverity>warning</violationSeverity>
105+
</configuration>
106+
<dependencies>
107+
<dependency>
108+
<groupId>com.puppycrawl.tools</groupId>
109+
<artifactId>checkstyle</artifactId>
110+
<version>10.5.0</version>
111+
</dependency>
112+
</dependencies>
113+
<executions>
114+
<execution>
115+
<id>test</id>
116+
<phase>test</phase>
117+
<goals>
118+
<goal>check</goal>
119+
</goals>
120+
</execution>
121+
</executions>
122+
</plugin>
95123
<plugin>
96124
<artifactId>maven-javadoc-plugin</artifactId>
97125
<version>3.4.1</version>
@@ -153,24 +181,6 @@
153181
<target>1.11</target>
154182
</configuration>
155183
</plugin>
156-
<plugin>
157-
<groupId>org.eluder.coveralls</groupId>
158-
<artifactId>coveralls-maven-plugin</artifactId>
159-
<version>4.3.0</version>
160-
<configuration>
161-
<serviceName>travis-ci</serviceName>
162-
</configuration>
163-
</plugin>
164-
<plugin>
165-
<groupId>org.codehaus.mojo</groupId>
166-
<artifactId>cobertura-maven-plugin</artifactId>
167-
<version>2.7</version>
168-
<configuration>
169-
<format>xml</format>
170-
<maxmem>256m</maxmem>
171-
<check />
172-
</configuration>
173-
</plugin>
174184
<plugin>
175185
<groupId>org.apache.maven.plugins</groupId>
176186
<artifactId>maven-jar-plugin</artifactId>

sample/Benchmark.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,20 @@ public static void main(String[] args) throws GeoIp2Exception, IOException {
3131
loop("Benchmarking", file, BENCHMARKS, new CHMCache());
3232
}
3333

34-
private static void loop(String msg, File file, int loops, NodeCache cache) throws GeoIp2Exception, IOException {
34+
private static void loop(String msg, File file, int loops, NodeCache cache)
35+
throws GeoIp2Exception, IOException {
3536
System.out.println(msg);
3637
for (int i = 0; i < loops; i++) {
37-
DatabaseReader r = new DatabaseReader.Builder(file).fileMode(FileMode.MEMORY_MAPPED).withCache(cache).build();
38+
DatabaseReader r =
39+
new DatabaseReader.Builder(file).fileMode(FileMode.MEMORY_MAPPED).withCache(cache)
40+
.build();
3841
bench(r, COUNT, i);
3942
}
4043
System.out.println();
4144
}
4245

43-
private static void bench(DatabaseReader r, int count, int seed) throws GeoIp2Exception, UnknownHostException {
46+
private static void bench(DatabaseReader r, int count, int seed)
47+
throws GeoIp2Exception, UnknownHostException {
4448
Random random = new Random(seed);
4549
long startTime = System.nanoTime();
4650
byte[] address = new byte[4];

0 commit comments

Comments
 (0)