How to add javaee-api as a dependency?


(Thufir) #1

what is the correct way to add javaee as a compile time dependency?

dependencies { providedCompile 'javax:javaee-api:7.0' }

http://www.adam-bien.com/roller/abien/entry/the_only_one_dependency_you

and:

// https://mvnrepository.com/artifact/javax/javaee-api provided group: 'javax', name: 'javaee-api', version: '7.0'

https://mvnrepository.com/artifact/javax/javaee-api/7.0

my build.gradle file

`

plugins {
id ‘com.gradle.build-scan’ version '1.8’
id 'java’
id 'application’
id ‘ear’
}

mainClassName = ‘net.bounceme.doge.json.Main’

buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service
licenseAgree = ‘yes’
}

repositories {
jcenter()
}

jar {
manifest {
attributes ‘Main-Class’: ‘net.bounceme.doge.json.Main’
}
}

task fatJar(type: Jar) {
baseName = project.name + '-all’
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
manifest {
attributes ‘Implementation-Title’: ‘Gradle Quickstart’, ‘Implementation-Version’: '3.4.0’
attributes ‘Main-Class’: ‘net.bounceme.doge.json.Main’
}
}

dependencies {
compile group: ‘javax.json’, name: ‘javax.json-api’, version: '1.1’
compile group: ‘org.glassfish’, name: ‘javax.json’, version: '1.1’
providedCompile ‘javax:javaee-api:7.0’
}

`