打包/Maven 化通用软件组件

发布于 2024-12-09 11:00:51 字数 1129 浏览 0 评论 0原文

我在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幽蝶幻影 2024-12-16 11:00:51

您的第一个错误是标准错误,是由存储库中的构建文件与您的构建工具版本之间的差异引起的。只需运行:

android update project -p ...

其中 ... 是相关项目的路径,用于更新构建文件。

您的第二个错误可以通过将以下行添加到 build.xml 中(位于 标记之后)来解决:

<path id="android.libraries.src"><path refid="project.libraries.src" /></path>
<path id="android.libraries.jars"><path refid="project.libraries.jars" /></path>

您将在 中看到这些行build.xml 的 MergeAdapter 版本,尽管它们显然不在 SackOfViewsAdapter build.xml 文件中,因为我没有接触过那个项目在一段时间内。

或者更好的是,我在哪里可以找到它预先打包的或在现有的 Maven 存储库中?

如果有的话,那也是非官方的,因为我不是 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:

<path id="android.libraries.src"><path refid="project.libraries.src" /></path>
<path id="android.libraries.jars"><path refid="project.libraries.jars" /></path>

You will see those lines in the MergeAdapter edition of build.xml, though they apparently are not in the SackOfViewsAdapter build.xml file, as I have not touched that project in some time.

Or better yet, where can I find it pre-packaged or in an existing maven repo?

If there is one, it's unofficial, as I am not a Maven user.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文