2014-02-27 47 views
5

我与maven.here想要一个简单的Android Hello World程序是我的pom.xml文件未能执行目标com.jayway.maven.plugins.android.generation2:Android的Maven的插件

<?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.example.androidmaven</groupId> 
<artifactId>gs-maven-android</artifactId> 
<version>0.1.0</version> 
<packaging>apk</packaging> 

<dependencies> 
    <dependency> 
     <groupId>com.google.android</groupId> 
     <artifactId>android</artifactId> 
     <version>4.1.1.4</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
      <artifactId>android-maven-plugin</artifactId> 
      <version>3.8.2</version> 
      <configuration> 
       <sdk> 
        <platform>19</platform> 
       </sdk> 
       <deleteConflictingFiles>true</deleteConflictingFiles> 
       <undeployBeforeDeploy>true</undeployBeforeDeploy> 
      </configuration> 
      <extensions>true</extensions> 
     </plugin> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

收到此错误

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:andr 
oid-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project gs 
-maven-android: Execution default-generate-sources of goal com.jayway.maven.plug 
ins.android.generation2:android-maven-plugin:3.8.2:generate-sources failed: Erro 
r reading D:\adt-bundle-windows-x86-20130522\sdk\tools\tools\source.properties - 
> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[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 rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio 
nException 

回答

0

我也得到同样的错误从詹金斯运行时。请参考以下

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project helloflashlight: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources failed: Error reading /home/iosmia/tools/android-sdk-linux/tools/source.properties -> [Help 1] 

注:我能使用命令行成功运行以下命令

mvn install 

更新:

我可以实现对读取文件的权限,如下图所示:

[email protected]:~/tools/android-sdk-linux/tools$ ls -l source.properties 
-rw-rw---- 1 iosmia iosmia 70 Mar 22 01:47 source.properties 

这意味着,詹金斯是'其他'用户,所以它无法阅读文件。在向下面的所有人授予读取权限后,我能够成功构建。

[email protected]:~/tools/android-sdk-linux/tools$ chmod 777 source.properties 
[email protected]:~/tools/android-sdk-linux/tools$ ls -l source.properties 
-rwxrwxrwx 1 iosmia iosmia 70 Mar 22 01:47 source.properties 
0

我面临同样的问题,并通过安装Swig解决。我正在使用MAC,这里是安装Swig的步骤。

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 

运行BREW安装痛饮痛饮安装然后运行

mvn install 

它解决了我的问题,希望能解决你的。

-3

尽管我完全不知道问题到底是什么,但从日志中我发现奇怪的是,插件从D:\ adt-bundle-windows-x86-20130522 \ sdk \ tools \ tools \中读取source.properties, source.properties。我认为正确的路径应该是... \ sdk \ tools \ source.properties。

你可以尝试以下的地方,看看什么是错的:

1.Eclipse:视窗|首选项| Android | SDK位置

2.用于ANDROID_HOME的Windows环境变量

相关问题