简体   繁体   中英

spring-android-auth maven artifact build error

I'm trying to build an android application with maven, and I would like to use the Spring Android Framework. I have added the necessary dependecies to my pom.xml as:

<dependencies>
<dependency>
    <groupId>org.springframework.android</groupId>
    <artifactId>spring-android-rest-template</artifactId>
    <version>1.0.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.android</groupId>
    <artifactId>spring-android-auth</artifactId>
    <version>1.0.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.android</groupId>
    <artifactId>spring-android-core</artifactId>
    <version>1.0.1.RELEASE</version>
</dependency>

Building with maven fails with maven-eclipse-plugin 2.9. I also tried to build my project with command line maven 3.0.5, both methods told me that:

[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Lorg/springframework/core/ErrorCoded;

If I remove the spring-andoid-auth dependency from my pom.xml, the project builds successfully. But if I leave only this as a dependency, and remove everything else, the error remains the same.

So I guess there's a problem with building the spring-android-auth artifact. Am I doing something wrong, or is anybody out there experiencing the same issue? How should I fix that if it can be fixed?

Here's my actual whole pom.xml for that 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>com.super.secret.project</groupId>
    <artifactId>super-secret-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>SuperSecretProject</name>


    <properties>
        <spring-android-version>1.0.1.RELEASE</spring-android-version>
        <android-version>4.1.1.4</android-version>
        <slidingmenu-version>1.3-SNAPSHOT</slidingmenu-version>
        <lombok-version>1.12.2</lombok-version>
        <android-annotations-version>2.2</android-annotations-version>
        <maven-eclipse-plugin-version>2.9</maven-eclipse-plugin-version>
        <android-platform>17</android-platform>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.android</groupId>
            <artifactId>spring-android-rest-template</artifactId>
            <version>${spring-android-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.android</groupId>
            <artifactId>spring-android-core</artifactId>
            <version>${spring-android-version}</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.android</groupId>
            <artifactId>spring-android-auth</artifactId>
            <version>${spring-android-version}</version>
        </dependency>


        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${android-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.jeremyfeinstein.slidingmenu</groupId>
            <artifactId>slidingmenu</artifactId>
            <version>${slidingmenu-version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.androidannotations</groupId>
            <artifactId>androidannotations</artifactId>
            <version>${android-annotations-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.androidannotations</groupId>
            <artifactId>androidannotations</artifactId>
            <classifier>api</classifier>
            <version>${android-annotations-version}</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>

        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.7.0</version>
                <extensions>true</extensions>
                <configuration>
                    <sdk>
                        <platform>${android-platform}</platform>
                    </sdk>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>${maven-eclipse-plugin-version}</version>
                <configuration>
                    <downloadSources>false</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Thank you in advance!

I guess you have a problem with the :spring-android-auth dependencies, this dependency is conflicting with :spring-android-core library .

I suggest you to exclude org.springframework.spring-core from it :

<dependency>
  <groupId>org.springframework.android</groupId>
  <artifactId>spring-android-auth</artifactId>
  <version>${spring-android-version}</version>
  <exclusions>

    <!-- Exclude in favor of Spring Android Core -->
    <exclusion>
      <artifactId>spring-core</artifactId>
      <groupId>org.springframework</groupId>
    </exclusion>

  </exclusions>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM