2013-08-29 33 views
0

如何將我的apklib轉換爲jar?我想開源並允許非Maven開發人員使用我的代碼。我的代碼不使用任何特定的Maven。它不使用xml文件或圖像,只是java。我嘗試將包裝更改爲罐子,但失敗了。將apklib轉換爲jar

<?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> 

    <parent> 
     <groupId>org.sonatype.oss</groupId> 
     <artifactId>oss-parent</artifactId> 
     <version>5</version> 
    </parent> 

    <version>1.0.0-SNAPSHOT</version> 

    <groupId>com.programmingarehard</groupId> 
    <artifactId>freshorm</artifactId> 
    <packaging>apklib</packaging> 
    <name>FreshORM</name> 


    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 

     <binary.prefix>fresh</binary.prefix> 
     <android.version>4.1.1.4</android.version> 
     <android.platform>16</android.platform> 
     <android.support.version>r7</android.support.version> 

     <!-- Test Dependencies --> 
     <junit.version>4.10</junit.version> 
     <fest.version>2.0M7</fest.version> 
     <robolectric.version>2.0-alpha-1</robolectric.version> 
    </properties> 

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

     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>${junit.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.easytesting</groupId> 
      <artifactId>fest-assert-core</artifactId> 
      <version>${fest.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.9.5</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.robolectric</groupId> 
      <artifactId>robolectric</artifactId> 
      <version>${robolectric.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.google.inject</groupId> 
      <artifactId>guice</artifactId> 
      <version>3.0</version> 
      <classifier>no_aop</classifier> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <artifactId>android-maven-plugin</artifactId> 
       <version>3.6.0</version> 
       <configuration> 
        <sdk> 
         <!-- platform or api level (api level 4 = platform 1.6)--> 
         <path>/Users/davidadams/Documents/android-sdk-macosx</path> 
         <platform>16</platform> 
        </sdk> 
        <undeployBeforeDeploy>true</undeployBeforeDeploy> 
       </configuration> 
       <extensions>true</extensions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <excludes> 
         <exclude>**/Test*.java</exclude> 
        </excludes> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

</project> 
+0

可能是你可以發佈作爲一個android庫項目源? – Manish

回答

0

我試圖改變包裝JAR和失敗。

我想你會更好地解決問題,導致JAR包裝失敗,而不是嘗試從Java字節碼轉換爲Davlik,然後再回來。

如果你提到如何它失敗了,我們也許可以幫你......


這裏有一個想法。用包裝「jar」創建第二個Maven項目/ POM,並將所有(可重用)Java代碼移動到那裏。然後讓這個項目成爲這個項目的依賴項。