问题描述
我正在寻找将groovy支持添加到现有的java项目中,这样我就可以使用invokedynamic无缝地编译混合的Java和Groovy代码,这样我就可以获得
阅读gmaven插件不再支持编译 - 并且groovy eclipse编译器插件,我问自己,为什么我要继续使用Maven,如果它编译的Groovy代码是不必要的慢?因此,我决定尝试为Gradle淘汰Maven,以便我可以获得更快的代码,同时将一些python部署脚本移植到Gradle任务中,以便只需要e。codebase。
我有一些库存储在一个简单的密码保护的s3 maven仓库中(为了避免像artifactory那样需要企业矫枉过正)。在做了一些基础研究之后,我发现Gradle没有内置的支持来添加自定义依赖关系管理,如和 。
我设法找到了 - 但它不涉及管理依赖项。
如果Gradle的整个点比Maven更灵活,如果依赖管理/构建系统的核心目的是有效地管理各种来源的依赖关系 - 那么缺乏对定制存储库的支持似乎是一个相当重要的重大设计缺陷,这使得我所遇到的任何问题,相比下。然而,我很可能错过了一些东西,并且我已经投入了几个小时的学习Gradle - 所以我想我会看看是否有一些合理的方法来模仿这些s3依赖项的依赖管理,直到Gradle开发人员解决这个关键问题。否则,我将不得不得出结论,我最好只使用Maven,并容忍较慢的Groovy代码,直到编译器插件支持invokedynamic为止。
基本上我需要一个解决方案:
- 将依赖关系和传递依赖关系下载到gradle缓存中
- 不需要我进行硬编码到gradle缓存的路径 - 这使得我的构建脚本是独立于平台的。
- 如果它们已经在缓存中,则不会再次下载它们。
然而,在文档中我找不到任何可以给我提供线索的东西至于从哪里开始:
Gradle 2.4对S3存储库有本地支持。下载依赖关系和发布工件。
使用IAM凭证进行下载(从上面的链接中解释):
<$ p
$ maven {
urls3:// someS3Bucket / path / to / repo / root
credentials(AwsCredentials){
accessKey'访问密钥'
secretKey'秘密密钥'
}
}
}
然后照常指定您的依赖关系。
I am looking to add Groovy support to an existing java project so that I can seemlessly compile mixed Java and Groovy code using invokedynamic so that I can get Java-like execution speed without needing to waste excessive amounts of time with verbose Java syntax
After reading that the gmaven plugin no longer supports compilation -and that the groovy eclipse compiler plugin doesn't yet support invokedynamic, I asked myself, why would I want to continue using Maven if it compiles Groovy code that is needlessly slow?
Consequently, I decided I would try scrapping maven for Gradle so that I could obtain faster code while also porting some python deployment scripts to Gradle tasks so as to only need one codebase.
I have some libraries stored on a simple password protected s3 maven repository (in order to avoid needing enterprise overkill like artifactory). After doing some basic research, I have found that Gradle has no built in support for adding in custom dependency management as determined by this stack overlow question and this support forums post.
I did manage to find a s3 plugin for gradle -but it doesn't deal with management of dependencies.
If the whole point of Gradle is to be more flexible than Maven and if the core purpose of a dependency management/ build system is to effectively manage dependencies from a variety of sources-then lack of support for custom repositories appears to be a fairly significant significant design flaw which makes any issues I have encounted with Maven thus far pale in comparison.
However, it is quite possible that I am missing something, and I have already invested several hours learning Gradle -so I figured I would see if there is some reasonable way to emulate dependency management for these s3 dependencies until Gradle developers fix this critical issue. Otherwise I will have to conclude that I am better off just using Maven and tolerating slower Groovy code until the compiler plugin supports invokedynamic.
Basically I need a solution that does the following:
- Downloads dependencies and transitive dependencies to the gradle cache
- Doesn't require me to hardcode the path to the gradle cache -so that my build script is platform independent.
- Doesn't download the dependencies again if they are already in the cache.
- Works with a multi-module project.
However, I cannot find anything in the documentation that would even give me a clue as to where to begin:
Gradle 2.4 has native support for S3 repositories. Both downloading dependencies and publishing artifacts.
To download with IAM credentials (paraphrased from the link above):
repositories {
maven {
url "s3://someS3Bucket/path/to/repo/root"
credentials(AwsCredentials) {
accessKey 'access key'
secretKey 'secret key'
}
}
}
Then specify your dependencies as usual.
这篇关于使用Gradle从私有Amazon S3存储库下载依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!