如何在Eclipse中使用Android应用程序解决Maven配置问题?

时间:2019-10-13 12:57:41

标签: java android eclipse maven

我在Eclipse中打开了像maven项目这样的Android应用,但这是Maven配置问题-未知? 我读了有关springboot项目Eclipse showing "Maven Configuration Problem: Unknown"的文章,但我不太理解。 enter image description here

整个pom.xml文件为:

<?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>at.axtesys</groupId>
<artifactId>soljoy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>soljoy</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <platform.version>4.1.1.4</platform.version>
    <android.plugin.version>3.9.0-rc.1</android.plugin.version>
</properties>

<repositories>
    <repository>
        <id>codehaus</id>
        <url>http://repository.codehaus.org/org/codehaus</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>${platform.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>
    <dependency>
        <groupId>com.loopj.android</groupId>
        <artifactId>android-async-http</artifactId>
        <version>1.4.4</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>com.github.tony19</groupId>
        <artifactId>logback-android-core</artifactId>
        <version>1.1.1-2</version>
    </dependency>
    <dependency>
        <groupId>com.github.tony19</groupId>
        <artifactId>logback-android-classic</artifactId>
        <version>1.1.1-2</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.6</version>
    </dependency>

</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>${android.plugin.version}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
                <sdk>
                    <platform>19</platform>
                </sdk>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
        </plugin>
    </plugins>
</build>

我使用了Android API 21和Java 8。 有人遇到过类似的问题吗?

1 个答案:

答案 0 :(得分:1)

我也为这个问题感到困惑,直到在这里找到解决方案eclipse-showing-maven-configuration-problem-unknown(您提到的相同网址)

您需要在pom.xml属性中添加以下内容

<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>

就像我pom.xml中的以下代码片段

<properties>
    <java.version>1.8</java.version>
    <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>