Attempt to move ByteBufProxy into the main codebase so it can be used. by buko · Pull Request #96 · lmdbjava/lmdbjava

Goal

Move ByteBufProxy into the main package so that it can be used by non-test clients. See #90 for more details.

Changes

  1. Move ByteBufProxy into the main src code.
  2. Add some tests and update the tutorial.
  3. Narrow the netty dependencies.

Issues

mdbjava is fortunately a standard Maven project but I still ran into several issues when trying to make changes:

  1. The build fails inside Eclipse. The culprit is the buildnumber plugin that wants git on the command line.
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project lmdbjava: Cannot get the revision information from the scm repository : 
[ERROR] Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "git" (in directory "C:\data\3rdcode\lmdbjava.git"): CreateProcess error=2, The system cannot find the file specified
[ERROR] -> [Help 1]

I've fixed this issue before in other projects many moons ago but forgot exactly how. I think it's possible to reconfigure the buildnumber plugin to use jgit instead of requiring the Git CLI. See https://github.com/alx3apps/jgit-buildnumber.

There are also alternatives to the buildnumber plugin that, for example, (eg https://github.com/release-engineering/buildmetadata-maven-plugin) that could be considered.

Was able to work around this issue by disabling the buildnumber plugin on the commandline/eclipse configuration.

  1. Ran into this error: "The type package-info is already defined"

This happens because the package org.lmdbjava in src/main/java and src/test/java define a 'package-info.java' file. Surprised the JDK allows this (it is a duplicate type) but Eclipse catches this and complains.

  1. The build blows up on Java10. Got it working by using JDK 1.8.0_92

  2. Ran into several issues with 'optional' dependencies. For now have made certain dependencies non-optional. Will need to investigate this further.

  3. The checkstyle issues are very harsh and fail the build. Admittedly don't a lot of time to see how to reproduce the desired code formatting rules in Eclipse. For now was able to disable the checkstyle plugin, using -Dcheckstyle.skip=true.

  4. Ran into PMD issues in an attempt to duplicate the tutorial test:

[INFO] PMD Failure: org.lmdbjava.TutorialTest:439 Rule:AvoidDuplicateLiterals Priority:3 The String literal "yyy" appears 4 times in this file; the first occurrence is on line 439.
[INFO] PMD Failure: org.lmdbjava.TutorialTest:442 Rule:AvoidDuplicateLiterals Priority:3 The String literal "ggg" appears 4 times in this file; the first occurrence is on line 442.

This was fixed by changing the tutorial test for Netty to use slightly different test values.

  1. For some very strange reason the act of building this project locally modifies the source code files. This may have to do with the maven license plugin. Not sure but unfortunately after making a few minor changes locally and building the project every file shows up as modified in this PR :(

Note that the only files actually modified were:

pom.xml
ByteBufProxy.java
ByteBufProxyTest.java
TutorialTest.java

Conclusion

By working around all the issues was able to build the project with the command: $ ~/data/applications/apache-maven-3.5.4/bin/mvn clean install -Dbuildnumber.phase=none -Dcheckstyle.skip=true

Installed a SNAPSHOT locally that has the desired changes: lmdbjava-0.6.2-SNAPSHOT.

More work is needed to actually get this merged. Will try to coordinate further with lmdbjava team around this PR.