什么是组,模块和神器? [英] What's in gradle a group, module and artifact?
问题描述
我已经详细了解了组,模块和
compile('com.thoughtworks.xstream:xstream:1.4.7 '){
exclude group:'xmlpull',module:'xmlpull'
}
大约一年前,我使用了我从 Android dalvik转换为xmlpullparser 修复多个dex文件失败。然而,升级到Android Studio 3.0后,再次发生错误!现在它说:多个dex文件定义了Lorg / xmlpull / mxp1 / MXParser
,有时还有 ... XmlPullParserException.java
So ,id喜欢了解我给出的参数 exclude
必须被整形。
//排除特定的传递依赖:
排除模块:'cglib'//由工件名称
排除组:'org.jmock'//按组
排除组:'org.unwanted',模块:'iAmBuggy'//由名称和group
另外中文网页( translated )排除
compile('com.thoughtworks.xstream:xstream:1.4.7'){
exclude group:' xmlpull'
exclude group:'XmlPullParser'
}
奇怪的是,当包名以
- 当
xmlpull
> org.xmlpull ? - 在我的方案中引用这些术语的项目。
- 什么样的组别是
XmlPullParser
? - 清理,重建或修改这些参数后只是建立项目?因为有时它会抱怨不同的文件。 随机的,不需要匹配jar文件中的包或类。
例如 commons-lang has groupId =' commons-lang'
,但这些类位于 org.apache.commons.lang。*
包中
组,工件和版本在项目的构建文件中定义。在maven中,它将位于 build.gradle
(和<$ c $)中的 pom.xml
c> settings.gradle )
如果您想知道该组,项目的版本(又名GAV,又名maven co-您可以使用 7Cgavrel =nofollow noreferrer> maven中央高级搜索到模糊搜索,例如artifactId或jar中的类名。如果您使用的是内部存储库,那么您也可能通过网络界面进行模糊搜索
The gradle docs don't take the time to explain the entities they are dealing with. That's why I want to ask such a basic question.
I've got a to understand in detail, what the terms group, module and artifact really mean to alter this code:
compile('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}
About a year ago I used that exclude statement I took from Android dalvik conversion for xmlpullparser to fix a Multiple dex files failure.
However, after upgrading to Android Studio 3.0 that error occurrs again! Now it says: Multiple dex files define Lorg/xmlpull/mxp1/MXParser
and sometimes ...XmlPullParserException.java
So, id like to understand how the parameters I give exclude
must be shaped.
Reading the documentation one could think a group is the package name and the artifact is the class:
//excluding a particular transitive dependency:
exclude module: 'cglib' //by artifact name
exclude group: 'org.jmock' //by group
exclude group: 'org.unwanted', module: 'iAmBuggy' //by both name and group
Another chinese page (translated) used those excludes
compile ( 'com.thoughtworks.xstream: xstream: 1.4.7' ) {
exclude group : 'xmlpull'
exclude group : 'XmlPullParser'
}
Built on that findings wonder
- how
xmlpull
worked when the package name begins withorg.xmlpull
? - what projects those terms refer to in my scenario. Where was the group name defined?
- What kinda group is
XmlPullParser
? - Must I clean, rebuild or just build the project after altering those parameters? Because sometimes it complains about different files.
The group, artifact and version are chosen semi randomly and do NOT need to match packages or classes in the jar file.
For example commons-lang has groupId = 'commons-lang'
but the classes are in org.apache.commons.lang.*
package
The group, artifact and version are defined within the build file of the project. In maven this will be in pom.xml
in gradle this will be in build.gradle
(and settings.gradle
)
If you want to know the group, artifact, version for a project (aka GAV, aka maven co-ordinates) you will usually go to the project's home page.
You can also use the maven central advanced search to "fuzzy" search eg by artifactId or by a classname within a jar. If you are using an in-house repository you can likely "fuzzy" search via the web interface there also
这篇关于什么是组,模块和神器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!