Reputation: 8757
I am migrating a project from Maven to Gradle and everything seems to be going well. I am however, getting caught up on a particular dependency.
In maven pom.xml the dependency was included as such:
<dependency>
<groupId>com.company</groupId>
<artifactId>models</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/libs/models-templates-1.0.0.jar</systemPath>
</dependency>
I have been looking into how to achieve something like this in gradle and haven't found a clear answer.
I thought I would need to first download the entire directory and extract the dependency so I started looking at this solution: How to add local .jar file dependency to build.gradle file?
However, after looking into what is happening a little more I've found that I actually need to declare an alternative jar name to download. So I still need it to look in the correct "models" group name but I need to download the "models-tempaltes" jar instead.
thank you.
Upvotes: 0
Views: 72
Reputation: 8757
I was able to find a solution to this.
The alternative to the pom.xml pattern of:
<dependency>
<groupId>com.company</groupId>
<artifactId>models</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/libs/models-templates-1.0.0.jar</systemPath>
</dependency>
would be
compile (group = 'com.company', name = 'models', version = '1.0.0') {
artifact {
name = 'models-data-template'
type = 'jar'
extension = 'jar'
}
}
Important to note that this needed both the type and extension properties to work, I tried w/ just the alternative name and that caused a bunch of errors.
Hope this helps someone.
Upvotes: 1