rod mclaughlin


You thought you'd escaped from the Maven Java dependency tool... (17 may 18)

It's many years since I had to deal with the Java dependency management tool Maven. But I'm trying to write a program in Elixir which decodes Bitcoin transactions. I can't make sense of the documentation, so what I need is code - in any language, which I can translate. "BitcoinJ" looks quite comprehensive. It's written in Java. Unfortunately, it depends on google.common, which depends on guava, which depends on 'mvn install', which runs for about an hour, then produces this:


[ERROR] Plugin org.codehaus.mojo:build-helper-maven-plugin:1.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:build-helper-maven-plugin:jar:1.7: Could not transfer artifact org.codehaus.mojo:build-helper-maven-plugin:pom:1.7 from/to central (https://repo.maven.apache.org/maven2): Connection reset -> [Help 1]

On second thoughts, it's the tests which have failed. It actually built the jars, so I'll try them. I know they were built by Maven, because they have the word "SNAPSHOT" in their names. Normally, failing tests means there's something wrong. But this is Java, so I knew that already.

To be fair, the BitcoinJ developers say you should use Gradle instead of "the aging Maven": https://bitcoinj.github.io/using-gradle. But when you run 'gradle build' it says

> Could not find method compile() for arguments [org.bitcoinj:bitcoinj-core:0.14.7] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
BUILD FAILED

 

I have to eat humble pie. I read the README.md file. It suggested doing this:

cd examples
mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.ForwardingService 
                      -Dexec.args="<insert a bitcoin address here>"

I ran

mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.ForwardingService 
                      -Dexec.args=374H1eBZjsrq4UfdsmorqeEdu5nEow7Dod

and

mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.FetchBlock 
 -Dexec.args=00000000c027e5b0e507d7cb990f50a1110e3fa45e7c5305af58b186f5863748

and it produced a lot of interesting output. It depends on bitcoind running. See https://github.com/pdxrod/blockchain_explorer.



Back
Portland London