2012-08-16 3 views
3

Ceci est pom.xml de mon projet de bibliothèque. Je fais "mvn clean install" et tout est OK. Dans mon local m2 repo j'ai artefact apklib.android-maven-plugin et le projet de bibliothèque

<?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>actionbar</artifactId> 
    <groupId>com.markupartist.android</groupId> 
    <name>android-actionbar</name> 
    <packaging>apklib</packaging> 
    <version>1.0</version> 


    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
      <platform.version>2.2.1</platform.version> 
    </properties> 

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


    <build> 
     <sourceDirectory>src</sourceDirectory> 
     <plugins> 
      <plugin> 
       <artifactId>android-maven-plugin</artifactId> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <version>3.3.0</version> 
       <configuration> 
        <sdk> 
         <path> 
          e:\Program Files\Android\android-sdk\ 
         </path> 
        </sdk> 
       </configuration> 
       <extensions>true</extensions> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <groupId>org.apache.maven.plugins</groupId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

Celui-ci pom.xml est de mon projet principal qui dépend de projet ci-dessus.

<?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.main.app</groupId> 
    <artifactId>VirtualRecruiter</artifactId> 
    <version>1.0</version> 
    <packaging>apk</packaging> 
    <name>MainApp</name> 

    <properties> 
     <platform.version>2.2.1</platform.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>com.google.android</groupId> 
      <artifactId>android</artifactId> 
      <version>${platform.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.roboguice</groupId> 
      <artifactId>roboguice</artifactId> 
      <version>2.0</version> 
     </dependency> 
     <dependency> 
      <groupId>actionbar</groupId> 
      <artifactId>com.markupartist.android</artifactId> 
      <version>1.0</version> 
      <type>apklib</type> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <artifactId>android-maven-plugin</artifactId> 
       <version>3.3.0</version> 
       <configuration> 
        <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile> 
        <assetsDirectory>${project.basedir}/assets</assetsDirectory> 
        <resourceDirectory>${project.basedir}/res</resourceDirectory> 
        <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory> 
        <sdk> 
         <path> 
          e:\Program Files\Android\android-sdk\ 
         </path> 
        </sdk> 
        <undeployBeforeDeploy>true</undeployBeforeDeploy> 
       </configuration> 
       <extensions>true</extensions> 
      </plugin> 

      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

IntelliJ peut voir mon depedency bien, mais quand je lance « mvn de compilation propre » sur le projet principal, j'ai obtenu: F

ailed pour exécuter objectif sur le projet MainApp: Impossible de résoudre dépendances pour le projet com.main.app:MainApp:apk:1.0: Impossible de trouver l'artefact actionbar: artist.android: apklib: 1,0

Lorsque j'utilise « sy stemPath 'et utilise un chemin codé en dur vers mon artefact, la dépendance peut être trouvée par maven, mais j'ai une erreur de compilation et javac ne voit aucune classe du projet de bibliothèque.

Répondre

1

sur le code que vous avez posté, vous avez fait une petite erreur peut-être qu'il va résoudre votre problème.

Vous avez inversé les groupId et artifactId sur votre dépendance afin que Maven ne puisse pas le trouver.

<dependency> 
    <groupId>actionbar</groupId> 
    <artifactId>com.markupartist.android</artifactId> 
    <version>1.0</version> 
    <type>apklib</type> 
</dependency> 
Questions connexes