Hi,
I’d like to generate a xml-File with alle informations about the dependencies, but I don’t know how to get the classifier and the extension form the dependencies.
Regards
Hi,
I’d like to generate a xml-File with alle informations about the dependencies, but I don’t know how to get the classifier and the extension form the dependencies.
Regards
Hi,
where can I get the classifier and the extension of a dependency?
Any hint would be appreciated.
Regards
The ‘classifier’ and ‘extension’ attributes are used to work out which ‘artifacts’ to attach to a dependency; they are not part of the dependency definition per se. You can get these values by looking at the contents of ‘ModuleDependency.getArtifacts()’.
If you’re interested in exactly how the ‘classifier’ and ‘extension’ attributes are processed, take a look at ‘org.gradle.api.internal.artifacts.dsl.dependencies.ModuleFactoryHelper’.
Hi Daz,
thanks for the reponse. I don’t understand why a dependency can have more then one artifact. Has this to do with the transitive dependencies?
Regards
The Maven POM is a very simple metadata format, that does not explicitly define artifacts. So when using a Maven repository you’ll get 1 artifact per dependency. However, the Ivy xml metadata format is much richer, and permits multiple artifacts to be defined for a single dependency module.
I know, I have to use differnt classifier for uploading more then one artifact. But this isn’t my problem. When I define a dependency like
dependencies {
compile(group: ‘com.oracle’, name: ‘ojdbc6’, version: ‘11.2.0.3.0’, classifier:‘sources, ext:‘zip’’) }
how can I access the classifier and extension of the ojdbc6 dependency in the code?
The ExternalModuleDependency class dosen’t provide this information.
The ‘classifier’ and ‘extension’ information is stored on the artifact level. See ‘ModuleDependency.getArtifacts()’.
ModuleDependency.getArtifacts() returns a set of DependencyArtifact but this class has no version included and it doesn’t contain the resolved depencencies.
For example: If I define a dependency like
compile(group: ‘jfree’, name: ‘jfreechart’, version: '1.0.+)
How can I get the resolved version of this dependency within a task?
You can use the ‘configuration.incoming’ API.
Hi Peter,
thanks, this works.
Regards Schoppi