我正在尝试通过此处找到的示例来了解 Maven Android 插件:https ://github.com/jayway/maven-android-plugin-samples/archives/stable
我正在使用示例“libraryproject”并且一切正常,只有一件事我真的无法弄清楚:如果我将某些内容更改为 lib1 项目(例如资源文件的内容)并编译主项目,我仍然在生成的 apk 文件中看到旧资源。
我试图清理,重建,我的apk没有变化......
抱歉,我的英语不好,愚蠢的问题结束了。
编辑:我就像yorkw所说的那样:
但现在我收到以下错误:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Library Projects Parent
[INFO] Library Projects - Library 1
[INFO] Library Projects - Library 2
[INFO] Library Projects - Main App
[INFO] Library Projects - Instrumentation Tests
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Library Projects Parent 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Library Projects - Library 1 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ libraryprojects-lib1 ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt.exe [package, -m, -J, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib1\target\generated-sources\r, -M, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib1\AndroidManifest.xml, -S, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib1\res, --auto-add-overlay, -A, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib1\assets, -I, C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-10\android.jar]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Library Projects - Library 2 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ libraryprojects-lib2 ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt.exe [package, -m, -J, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib2\target\generated-sources\r, -M, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib2\AndroidManifest.xml, -S, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib2\res, --auto-add-overlay, -A, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-lib2\assets, -I, C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-10\android.jar]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Library Projects - Main App 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ libraryprojects-mainapp ---
[DEBUG] Expanding: C:\Users\nicola\.m2\repository\com\jayway\maven\plugins\android\generation2\samples\libraryprojects\libraryprojects-lib1\1.0.0-SNAPSHOT\libraryprojects-lib1-1.0.0-SNAPSHOT.apklib into C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs\com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib1_apklib_1.0.0-SNAPSHOT
[DEBUG] expand complete
[DEBUG] Expanding: C:\Users\nicola\.m2\repository\com\jayway\maven\plugins\android\generation2\samples\libraryprojects\libraryprojects-lib2\1.0.0-SNAPSHOT\libraryprojects-lib2-1.0.0-SNAPSHOT.apklib into C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs\com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib2_apklib_1.0.0-SNAPSHOT
[DEBUG] expand complete
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt.exe [package, -m, -J, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\generated-sources\r, -M, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\AndroidManifest.xml, -S, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\res, -S, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib1_apklib_1.0.0-SNAPSHOT/res, -S, C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib2_apklib_1.0.0-SNAPSHOT/res, --auto-add-overlay, -I, C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-10\android.jar]
[INFO] C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\res\layout\main.xml:12: error: Error: No resource found that matches the given name (at 'text' with value '@string/lib1resource').
[INFO] C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\res\layout\main.xml:17: error: Error: No resource found that matches the given name (at 'text' with value '@string/lib2resource').
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:338)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:102)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt.exe" package -m -J C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\generated-sources\r -M C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\AndroidManifest.xml -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\res -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib1_apklib_1.0.0-SNAPSHOT/res -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib2_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -I "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-10\android.jar"", Result = 1
at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:215)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:336)
... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Library Projects Parent ........................... SUCCESS [0.004s]
[INFO] Library Projects - Library 1 ...................... SUCCESS [1.109s]
[INFO] Library Projects - Library 2 ...................... SUCCESS [0.299s]
[INFO] Library Projects - Main App ....................... FAILURE [0.489s]
[INFO] Library Projects - Instrumentation Tests .......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.277s
[INFO] Finished at: Wed Apr 18 02:46:34 CEST 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project libraryprojects-mainapp: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\aapt.exe" package -m -J C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\generated-sources\r -M C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\AndroidManifest.xml -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\res -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib1_apklib_1.0.0-SNAPSHOT/res -S C:\Users\nicola\Desktop\maven_example\jayway-maven-android-plugin-samples-c475bf4\libraryprojects\libraryprojects-mainapp\target\unpack\apklibs/com.jayway.maven.plugins.android.generation2.samples.libraryprojects_libraryprojects-lib2_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -I "C:\Program Files (x86)\Android\android-sdk-windows\platforms\android-10\android.jar"", Result = 1 -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :libraryprojects-mainapp