2013-12-15 25 views
1

我正在使用maven 3.1.1。 Eclipse Kepler與Android-Configurator for M2E一起安裝。有錯誤的maven android插件(依賴= [android.support:compatibility-v7:apklib:19:compile]找不到)

我的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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.company.sample</groupId> 
    <artifactId>SampleApplication</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>apk</packaging> 
    <name>SampleApplication</name> 
    <description>A sample application to demo clean android code.</description> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <platform.version>2.3.1</platform.version> 
     <android.plugin.version>3.6.0</android.plugin.version> 
    </properties> 

    <dependencies> 
     <!-- android SDK --> 
     <dependency> 
      <groupId>com.google.android</groupId> 
      <artifactId>android</artifactId> 
      <version>2.3.1</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- support-v4 --> 
     <dependency> 
      <groupId>com.android.support</groupId> 
      <artifactId>support-v4</artifactId> 
      <version>19.0.0</version> 
      <scope>compile</scope> 
      <exclusions> 
       <exclusion> 
        <groupId>com.google.android</groupId> 
        <artifactId>support-v4</artifactId> 
       </exclusion> 
      </exclusions> 

     </dependency> 

     <!-- v7-extra --> 
     <dependency> 
      <groupId>android.support</groupId> 
      <artifactId>compatibility-v7</artifactId> 
      <version>19</version> 
      <type>apklib</type> 
     </dependency> 

     <dependency> 
      <groupId>android.support</groupId> 
      <artifactId>compatibility-v7</artifactId> 
      <version>19</version> 
      <type>jar</type> 
     </dependency> 

     <!-- v7-appcompat --> 
     <dependency> 
      <groupId>android.support</groupId> 
      <artifactId>compatibility-v7-appcompat</artifactId> 
      <version>19</version> 
      <type>apklib</type> 
     </dependency> 

     <dependency> 
      <groupId>android.support</groupId> 
      <artifactId>compatibility-v7-appcompat</artifactId> 
      <version>19</version> 
      <type>jar</type> 
     </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>3.6.0</version> 
        <extensions>true</extensions> 
       </plugin> 
       <plugin> 
        <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
        <artifactId>android-maven-plugin</artifactId> 
        <configuration> 
         <sdk> 
          <platform>18</platform> 
         </sdk> 
         <action> 
          <ignore></ignore> 
         </action> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 

     <plugins> 
      <plugin> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <artifactId>android-maven-plugin</artifactId> 
       <configuration> 
        <sdk> 
         <path>${env.ANDROID_HOME}</path> 
         <platform>18</platform> 
        </sdk> 
        <deleteConflictingFiles>true</deleteConflictingFiles> 
       </configuration> 
       <extensions>true</extensions> 
      </plugin> 

     </plugins> 

    </build> 

    <profiles> 
     <profile> 
      <id>allow-snapshots</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <repositories> 
       <repository> 
        <id>snapshots-repo</id> 
        <url>https://oss.sonatype.org/content/repositories/snapshots</url> 
        <releases> 
         <enabled>false</enabled> 
        </releases> 
        <snapshots> 
         <enabled>true</enabled> 
        </snapshots> 
       </repository> 
      </repositories> 
     </profile> 
    </profiles> 

</project> 

命令:MVN全新安裝,成功構建,但刷新Eclipse中的項目給出了這樣的錯誤:

dependency=[android.support:compatibility-v7:apklib:19:compile] not found in workspace pom.xml /SampleApplication line 1 me.gladwell.eclipse.m2e.android.markers.dependency.apklib 

snapshot of eclipse situation

回答

0

通過下載eclipse 4.3.1的新副本並重新安裝以下內容來修復此問題:

  1. ADT pluugin
  2. M2E
  3. M2E-的Android

然後導入它建立了良好的同一個項目:MVN乾淨安裝。

然後從構建路徑中刪除所有庫並執行:Android-Tools>修復項目屬性。