打包/Maven 化通用软件组件
我在我的 android 项目中使用合并列表,到目前为止我只是将源代码与其余代码一起推入我的 src 根目录中。然而我没有修改任何东西,所以我认为是时候将这些东西作为库包含进来了。我克隆了第一个存储库并且:
$ ant
Buildfile: /Users/user/dev/projects/cwac-sacklist/build.xml
BUILD FAILED
/Users/user/dev/projects/cwac-sacklist/build.xml:49: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[]
Total time: 0 seconds
看起来这个 ant 脚本正在寻找由“android”工具创建的一些东西..但我没有看到任何文档..但我看到缺少的 prop sdk.dir.. 所以我在 local.properties 中创建它..但后来我得到:
/Users/user/dev/libs/android-sdk-mac_x86/tools/ant/lib_rules.xml:126: Reference android.libraries.src not found.
打包这些东西以便我可以将其放入本地 Maven 存储库中的正确方法是什么?或者更好的是,我在哪里可以找到它预先打包的或在现有的 Maven 存储库中?
更新 - 2014-07-08
看起来commonsware现在将所有这些东西都放在适当的存储库中:
来自:https://github.com/commonsguy/cwac-sacklist
repositories {
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
dependencies {
compile 'com.commonsware.cwac:sacklist:1.0.0'
}
I am using merge list in my android project and up until now I have just been shoving the source into my src root with the rest of my code. However I'm not modifying anything so I figured it was time to include this stuff as libraries. I clone the first repo and:
$ ant
Buildfile: /Users/user/dev/projects/cwac-sacklist/build.xml
BUILD FAILED
/Users/user/dev/projects/cwac-sacklist/build.xml:49: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[]
Total time: 0 seconds
It looks like this ant script is looking for some stuff created by the "android" tool.. but I don't see any docs.. but I see the missing prop sdk.dir.. so I create that in local.properties.. but then I get:
/Users/user/dev/libs/android-sdk-mac_x86/tools/ant/lib_rules.xml:126: Reference android.libraries.src not found.
What is the right way to go about packaging this stuff so I can shove it in my local maven repo? Or better yet, where can I find it pre-packaged or in an existing maven repo?
UPDATE - 2014-07-08
It looks like commonsware now has all this stuff in a proper repo:
from: https://github.com/commonsguy/cwac-sacklist
repositories {
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
dependencies {
compile 'com.commonsware.cwac:sacklist:1.0.0'
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第一个错误是标准错误,是由存储库中的构建文件与您的构建工具版本之间的差异引起的。只需运行:
android update project -p ...
其中
...
是相关项目的路径,用于更新构建文件。您的第二个错误可以通过将以下行添加到
build.xml
中(位于
标记之后)来解决:您将在
中看到这些行
版本,尽管它们显然不在build.xml
的 MergeAdapterSackOfViewsAdapter
build.xml
文件中,因为我没有接触过那个项目在一段时间内。如果有的话,那也是非官方的,因为我不是 Maven 用户。
Your first error is a standard one, caused by a discrepancy between the build files in the repo and your version of the build tools. Simply run:
android update project -p ...
where
...
is the path to the project in question, to update the build files.Your second error is solved by adding the following lines to
build.xml
, just after the<setup/>
tag:You will see those lines in the
MergeAdapter
edition ofbuild.xml
, though they apparently are not in theSackOfViewsAdapter
build.xml
file, as I have not touched that project in some time.If there is one, it's unofficial, as I am not a Maven user.