mavenbitcoinbitcoinj

Maven 'clean install' fails when maven is upgraded from 3.1.1 to 3.3.3


I'm trying to build the litecoin wallet for android that I cloned from github: https://github.com/Litecoin-Java/bitcoin-wallet

I've been banging my head against the wall for days because trying to build this thing constantly causes more and more errors. The instructions on github simply say to run "mvn clean install" but it's not that simple for me it seems. This is my first time using maven and also my first time doing anything with the bitcoinj library.

This is sort of two problems in one because I also run into errors when I try to set the bitcoinj dependency to v0.12.3 (most recent) instead of v0.10.3 (very old...)

After days I finally got it to work after a few changes:

Environmental variables such as HOME_JAVA and ANDROID_HOME have been set correctly. I also made sure to add maven, androidsdk/tools and /platform-tools to my PATH.

I'm running Ubuntu 14.04.

Running maven 3.1.1 and bitcoinj v0.10.3 I get

[INFO] base .............................................. SUCCESS [0.384s]
[INFO] Bitcoin Integration for Android ................... SUCCESS [1.448s]
[INFO] Bitcoin Wallet .................................... SUCCESS [49.624s]
[INFO] Sample for Bitcoin Integration for Android ........ SUCCESS [2.128s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Upgrading to maven 3.3.3 (while still using bitcoinj v0.10.3) I get:

[INFO] base ............................................... SUCCESS [  0.453 s]
[INFO] Bitcoin Integration for Android .................... SUCCESS [  1.937 s]
[INFO] Bitcoin Wallet ..................................... FAILURE [ 41.376 s]
[INFO] Sample for Bitcoin Integration for Android ......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.952 s
[INFO] Finished at: 2015-05-22T11:23:01+00:00
[INFO] Final Memory: 29M/332M
[INFO] ------------------------------------------------------------------------
[ERROR] Unable to provision, see the following errors:
[ERROR] 
[ERROR] 1) No implementation for org.eclipse.aether.connector.wagon.WagonProvider was bound.
[ERROR] while locating org.eclipse.aether.connector.wagon.WagonRepositoryConnectorFactory
[ERROR] at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0, parent: sun.misc.Launcher$AppClassLoader@665ce0fe] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0, parent: sun.misc.Launcher$AppClassLoader@665ce0fe] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.eclipse.aether.spi.connector.RepositoryConnectorFactory annotated with @com.google.inject.name.Named(value=wagon)
[ERROR] 
[ERROR] 1 error

Setting version of bitcoinj depenedency to 0.12.3 I get:

[ERROR] Failed to execute goal on project wallet: Could not resolve dependencies for project de.schildbach.wallet:wallet:apk:3.29-test: Could not find artifact com.google:bitcoinj:jar:0.12.3 in central (http://repo.maven.apache.org/maven2) -> 

I no this means I need to get and build 0.12.3 myself but I don't know how to let my project know where to find my custom built version.

I've no idea what might be causing this, as I'm not experienced with either bitcoinj or maven like I said before. Most errors I've come across at least turn up some google results that have helped me but I can't find much when I search for version problems with either of these.

Here's the POM for the entire project:

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <modelVersion>4.0.0</modelVersion>

    <groupId>de.schildbach.wallet</groupId>
    <artifactId>base</artifactId>
    <name>base</name>
    <version>1</version>
    <packaging>pom</packaging>

    <modules>
        <module>wallet</module>
        <module>integration-android</module>
        <module>sample-integration-android</module>
    </modules>

    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.5</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.15</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.2.1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <genDirectory>${basedir}/gen</genDirectory>
                    </configuration>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>2.9</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.8</version>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

Here's the POM for the 'wallet' folder specifically:

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <modelVersion>4.0.0</modelVersion>

    <artifactId>wallet</artifactId>
    <packaging>apk</packaging>
    <version>3.29-test</version>
    <name>Bitcoin Wallet</name>

    <parent>
        <groupId>de.schildbach.wallet</groupId>
        <artifactId>base</artifactId>
        <version>1</version>
    </parent>

    <dependencies>

        <!-- android.*, java.*, javax.* -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.0.1.2</version>
            <scope>provided</scope>
        </dependency>

        <!-- android.annotation.* -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>annotations</artifactId>
            <!-- version should match android artifact, but not available on maven central -->
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>

        <!-- android.support.v4.* -->
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>

        <!-- com.actionbarsherlock.* -->
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>library</artifactId>
            <version>4.1.0</version>
            <type>apklib</type>
        </dependency>

        <!-- com.google.bitcoin.* -->
        <dependency>
            <groupId>com.google</groupId>
            <artifactId>bitcoinj</artifactId>
            <version>0.12.3</version>
        </dependency>

        <!-- de.schildbach.wallet.integration.android.* -->
        <dependency>
            <groupId>de.schildbach.wallet</groupId>
            <artifactId>integration-android</artifactId>
            <version>1.0</version>
        </dependency>

        <!-- com.google.zxing.* -->
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <version>2.2</version>
        </dependency>

        <!-- org.slf4j.* -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>

        <!-- ch.qos.logback.classic.* -->
        <dependency>
            <groupId>com.github.tony19</groupId>
            <artifactId>logback-android-classic</artifactId>
            <version>1.0.10-2</version>
        </dependency>

        <!-- ch.qos.logback.core.* -->
        <dependency>
            <groupId>com.github.tony19</groupId>
            <artifactId>logback-android-core</artifactId>
            <version>1.0.10-2</version>
        </dependency>

        <!-- javax.annotation.* -->
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>2.0.1</version>
        </dependency>

        <!-- org.junit.* -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                        <artifactId>android-maven-plugin</artifactId>
                        <configuration>
                            <release>true</release>
                            <proguard>
                                <skip>false</skip>
                            </proguard>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- to build, run: mvn clean install -->
    <!-- then to install on an android device, run: mvn android:deploy -->
    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.8.2</version>
                <configuration>
                    <excludeJarResources>
                        <excludeJarResource>.*\.jar$</excludeJarResource>
                    </excludeJarResources>
                    <sdk>
                        <platform>14</platform>
                    </sdk>
                    <sign>
                        <debug>both</debug>
                    </sign>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                    <additionalProjectnatures>
                        <projectnature>com.android.ide.eclipse.adt.AndroidNature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>com.android.ide.eclipse.adt.ResourceManagerBuilder</buildcommand>
                        <buildcommand>com.android.ide.eclipse.adt.PreCompilerBuilder</buildcommand>
                        <buildcommand>com.android.ide.eclipse.adt.ApkBuilder</buildcommand>
                    </additionalBuildcommands>
                    <classpathContainers>
                        <classpathContainer>com.android.ide.eclipse.adt.ANDROID_FRAMEWORK</classpathContainer>
                        <!-- This is a workaround: we do not want JRE_CONTAINER, however if we remove it, it will be automatically added, and 
                            placed first. So we add it in the second position, so that the project is recognized as an Android project. -->
                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
                    </classpathContainers>
                    <excludes>
                        <exclude>android:android</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- to generate reports, run: mvn clean install site -->
    <!-- then browse to: target/site/index.html -->
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <onlyAnalyze>de.schildbach.wallet.-</onlyAnalyze>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

</project>

Thanks for your help.


Solution

  • It's seems that for 0.12.3 version the dependency have changed the groupid.

    Here's the new depedency :

    <dependency>
      <groupId>org.bitcoinj</groupId>
      <artifactId>bitcoinj-core</artifactId>
      <version>0.12.3</version>
      <scope>compile</scope>
    </dependency>
    

    You can check it here (Maven central) and here (bitcoinj site).