当maven从3.1.1升级到3.3.3时,Maven'干净安装'失败

时间:2015-05-22 11:56:37

标签: maven bitcoin bitcoinj

我正在尝试为我从github克隆的android构建litecoin钱包:https://github.com/Litecoin-Java/bitcoin-wallet

几天来,我一直在撞墙,因为试图建造这种东西不断导致越来越多的错误。 github上的说明只是说要运行“mvn clean install”,但对我来说似乎并不那么简单。这是我第一次使用maven,也是我第一次使用bitcoinj库做任何事情。

这是一个两个问题,因为当我尝试将bitcoinj依赖项设置为v0.12.3(最近的)而不是v0.10.3(非常旧...)时,我也会遇到错误。

经过几天的改变后,我终于开始工作了:

  • 使用Maven 3.1.1而不是最新版本Maven 3.3.3
  • 在项目的POM中将bitcoinj依赖项设置为v0.10.3而不是 最新版本,v0.12.3
  • 修复POM的内容,例如将maven-android-plugin版本更改为3.8 (这修正了一些错误)和设置源,目标= 1.7为
    POM中的maven-compiler-plugin(这也解决了我遇到的错误 编译项目时遇到问题)

已正确设置HOME_JAVA和ANDROID_HOME等环境变量。我还确保将maven,androidsdk / tools和/ platform-tools添加到我的PATH中。

我正在运行Ubuntu 14.04。

运行maven 3.1.1和bitcoinj v0.10.3我得到了

[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

升级到maven 3.3.3(同时仍使用bitcoinj v0.10.3)我得到:

[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

将bitcoinj depenedency的版本设置为0.12.3我得到:

[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) -> 

我不是这意味着我需要自己构建0.12.3,但我不知道如何让我的项目知道在哪里找到我的自定义版本。

我不知道是什么原因造成这种情况,因为我没有像之前说的那样经历过bitcoinj或maven。我遇到的大多数错误至少会显示一些帮助我的谷歌搜索结果,但是当我搜索其中任何一个的版本问题时,我找不到多少。

这是整个项目的POM:

<?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>

以下是'wallet'文件夹的POM:

<?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>

感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

maven 3.2&amp; amp; 3.3。 Pleanse使用maven 3.1。试试这个:

brew install homebrew/versions/maven31
sudo ln -s /usr/local/Cellar/maven31/3.1.1 /usr/local/Cellar/maven/
brew switch maven 3.1.1

答案 1 :(得分:0)

似乎对于0.12.3版本,依赖关系已经改变了groupid。

这是新的依赖性:

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

您可以查看here(Maven central)和here(bitcoinj网站)。