I am new to Gradle and am trying to setup a proof of concept build for my company to see if we want to use Gradle for our build system.
I am trying to grab a JAR file from my machine in a directory. I have set this up to use Maven. The project in question called Common was not a Maven project originally just an eclipse project. I added a pom.xml to the JAR directory so Maven can recognize it. (potential problem #1). I have installed Maven. Im my build.gradle I check the file location to ensure that it was correct. Gradle seems to just go past the JAR file.
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.7
version = '1.0'
group = 'com.ngc.as.fl.melbourne.oms'
//project properties
project.ext{
repo="C:\Users\J29682\OMS_repo"
}
assert project.repo == 'C:\Users\J29682\OMS_repo' //check file path on my machine
repositories {
maven{
url "$project.repo"
//layout 'maven'
}
flatDir{
dirs "$project.repo"
}
//mavenCentral()
}
dependencies {
compile group: 'com.ngc.as.fl.melbourne', name:'common', version: '1.0'
compile group: 'au.com.bytecode', name: 'opencsv', version: '2.4'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Output:
UILD FAILED
Total time: 0.427 secs
Could not find com.ngc.as.fl.melbourne:common:1.0.
Searched in the following locations:
file:/C:/Users/J29682/OMS_repo/com/ngc/as/fl/melbourne/common/1.0/common-1.0.pom
file:/C:/Users/J29682/OMS_repo/com/ngc/as/fl/melbourne/common/1.0/common-1.0.jar
file:/C:/Users/J29682/OMS_repo/common-1.0.jar
file:/C:/Users/J29682/OMS_repo/common.jar
Required by:
com.ngc.as.fl.melbourne.oms:ProductManager:1.0
12:54:34 PM: External task execution finished 'build'.
pom.xml from common project
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ngc.as.fl.melbourne</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
<dependencies>
<dependencies>
<repositories>
<repository>
<id>OMS_repo</id>
<url>C:\Users\J29682\maven_local_repository</url>
</repository>
</repositories>
</project>
repo folder structure on machine: com.ngc.as.fl.melbourne
common
1.0
common-1.0.jar
pom.xml