I'm creating a web project using Gradle (buildship) in Eclipse (WTP). I've put the libraries I need as "implementation" dependencies in my build.gradle, however they are not copied to Tomcat when I try to run the project from within Eclipse. When I build the WAR file (with gradle war), however, all the jar files are there.
I can't find anywhere the solution for this. It's beeing awful to manually (and redundantly) copying every jar and its dependency to WEB-INF/libs just to be able to run the app from Eclipse).
I've found a workaround here: https://github.com/eclipse/buildship/issues/496
It's adding this to build.gradle:
eclipse {
wtp {
component {
libConfigurations += [configurations.runtimeClasspath]
}
}
}
With this everything gets properly deployed.
UPDATE!
Gradle 5.3 has just been released and includes a fix for this issue and the hack above is not needed anymore.
The only thing that worked for me was changing
dependencies {
implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}
too
dependencies {
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
}
Related
I'm making project with springboot 2.
And want to make my common library module.
So I maked common and Module A modules.
I wanted to use mysql-connector-java:5.1.40, so I set in my common module's build.gradle dependency.
But when I import common to Module A, Module A has mysql-connector-java:8.0.15
my build.gradle files like this.
springBootVersion : 2.1.4.RELEASE
common's build.gradle dependency
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-webflux:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}")
compile("org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-data-redis:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-data-cassandra:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
compile("org.springframework.kafka:spring-kafka:${springKafkaVersion}")
compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.2.0'
compile group: 'org.apache.curator', name: 'curator-recipes', version: '4.2.0'
compile('mysql:mysql-connector-java:5.1.40')
}
Module A's build.gradle dependency
dependencies {
compile project(":common")
}
I don't know why version changed.
Is any library have mysql-connector-java:8.0.15 in my used??
I resolved.
Mayby it was intellij's bug......
I tried fixing build.gradle, cleaning IntelliJ cache.... etc.. But not resolved in my pc.
In other's pc, my build.gradle works great :(
So, I try re-installing IntelliJ and resolve my problem.
Thank you all for answering......
As we know org.springframework.boot support hot deploy to detect any changes
without restart application.
It works with maven when I run it with mvn spring-boot:run
but it does not work when I run it with gradle bootRun, it does not detect property file change automatically .
in my build.gradle i defined it already.
any hints will be more than welcome!
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version:'2.0.4.RELEASE'
You probably need to configure bootRun to load resources from src/main/resources rather than their built location beneath build. You can do so with the following configuration:
bootRun {
sourceResources sourceSets.main
}
Alternatively, you could use Gradle's continuous build support so that any changes in src/main/resources or src/main/java are automatically detected and then built. DevTools will then notice the changes in the build's output and reload.
Im trying to download and build spring-data-hadoop 2.4.0.RELEASE using the following decleration in my dependencies.gradle:
dependencies {
...
// compile('org.springframework.data:spring-data_hadoop:2.4.0.RELEASE')
compile group: 'org.springframework.data', name: 'spring-data-hadoop', version: '2.4.0.RELEASE'
...
}
Refreshing gradle now results in downloading the newly added dependency BUT the data is not consistend. I got the following external dependencies after the download:
I thought everything is fine now... but I am wrong. Lets open up one of those and look depper into the packages:
If you compare the content of org.springframework.data.hadoop.config with the official API you will notice, that in this package, there should be much more content. The annotations package for example.
How can it be that gradle is not downloading the complete source?
There is a separate spring-data-hadoop-config with the description "Spring for Apache Hadoop Annotation Configuration", so that's probably where annotations would be.
You are pulling the main jar that should pull the transitive artifacts as well.
the org.springframework.data.hadoop.config.annotation is included inside
compile group: 'org.springframework.data', name: 'spring-data-hadoop-config', version: '2.4.0.RELEASE'
I'm using Gradle and want to build an EAR that includes a pre-built WAR file found in a repository. I got things working like this:
dependencies
{
earlib 'PathName:NameOfPreBuiltWar:Version#war'
}
ear
{
libDirName '/'
}
This seems to work perfectly, but isn't the way earlib or libDirName were intended to be used. Is there a better way?
The ear plugin also provides a deploy configuration, so this should be sufficient:
dependencies {
deploy 'PathName:NameOfPreBuiltWar:Version#war'
}
I'm trying to exclude few jars from the .classpath file which is generated by the gradle eclipse plugin. Though i do the following stuff in my build.gradle to exclude these jars, the classpath still contains these jar files.
configurations {
eclipseExcludedDeps
}
dependencies {
eclipseExcludedDeps group: "javax", name:"javaee-api", version: "${versions.javaee_api}"
eclipseExcludedDeps group: "javax.xml.parsers", name:"jaxp-api", version: "${versions.jaxp_api}"
eclipseExcludedDeps group: "xerces", name:"xmlParserAPIs", version: "${versions.xmlParserAPIs}"
}
eclipse {
wtp {
component {
minusConfigurations << configurations.eclipseExcludedDeps
}
}
}
I have tried all the approaches mentioned in the gradle docs but none of the them works for me.
I'm using gradle version 2.7. To create the classpath i run 'gradle eclipse' command.
Can someone please help me on this.
I'm not a WTP user myself but I think you'll need to configure eclipse.classpath
eclipse {
classpath {
minusConfigurations += [ configurations.eclipseExcludedDeps ]
}
}