Domanda

I have an android lib (customized, integrated zxing barcode scanner lib) that's not built with maven. So I try to use mvn install:install-file to create the apklib to my local maven repository.

Therefore I run:

mvn install:install-file -Dfile=zxing-integrated-1.0.apklib \
                         -DgroupId=com.google.zxing \
                         -DartifactId=zxing-integrated \
                         -Dversion=1.0 \
                         -Dpackaging=apklib \
                         -DgeneratePom=true \
                         -DcreateChecksum=true

which return the following on the command line:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Users/myuser/Projects/myproject/zxing/zxing-integrated-1.0.apklib to /Users/myuser/.m2/repository/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.apklib
[INFO] Installing /var/folders/s0/0qcqwh696150dhq_lb0l3pd80000gn/T/mvninstall735817733736670848.pom to /Users/myuser/.m2/repository/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.488s
[INFO] Finished at: Thu Feb 21 11:27:23 CST 2013
[INFO] Final Memory: 7M/94M
[INFO] ------------------------------------------------------------------------

but no apklib file is being created in the maven repo. All I get there is:

enter image description here

So I wonder, what's wrong with above install-file command. This is the project structure of the lib project, which I am trying to build the apklib for. It follows the regular Android project structure (not Android Maven project structure, which I am assuming is the right way to do?)

enter image description here

When I run the mvn install of my main project, which pom.xml includes:

    <dependency>
        <groupId>com.google.zxing</groupId>
        <artifactId>zxing-integrated</artifactId>
        <version>1.0</version>
        <type>apklib</type>
    </dependency>

I am getting:

> mvn install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.myproject.subname.android 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.jar
Downloading: http://repo1.maven.org/maven2/com/google/zxing/zxing-integrated/1.0/zxing-integrated-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.128s
[INFO] Finished at: Thu Feb 21 11:13:20 CST 2013
[INFO] Final Memory: 11M/137M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project com.myproject.subname.android: Could not resolve dependencies for project com.myproject:com.myproject.subname.android:apk:1.0-SNAPSHOT: Could not find artifact com.google.zxing:zxing-integrated:jar:1.0 in snapshots-repository (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
È stato utile?

Soluzione

The maven install-file goal just uploads an existing file to the local repository. It does not create the file. You must have an existing file zxing-integrated-1.0.apklib so that you can upload it with the command.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top