为gwt-user / dev提供gradle provideCompile会导致其他jar从WAR中消失 [英] gradle providedCompile for gwt-user/dev causes other jars to disappear from WAR
问题描述
当包含GWT时,像
dependencies {
compilecom.google.gwt:gwt-user:2.5.1
compilecom.google.gwt:gwt-dev:2.5.1
...
}
然后我有gwt-user.jar和gwt-生成的WAR文件中的dev.jar。他们不是真的需要,而且很大。如果我
但是当我尝试在没有这些jar的情况下使用
dependencies {
providesCompilecom.google.gwt:gwt-user:2.5.1
providesCompilecom。 google.gwt:gwt-dev:2.5.1
...
}
org.springframework.beans.factory.BeanCreationException:使用名称创建bean时出错在类路径资源[application-context.xml]中定义的'entityManagerFactory':调用init方法失败;嵌套异常是org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(java.lang.ArrayStoreException: pre>
和其他奇怪的错误消息。
如何从Gradle构建中正确排除gwt-user和gwt-dev的jar包?
解决方案 在 compile
部分列出的其他罐子也从WAR中消失。它可以快速检查(你可能不会组装整个战争)与
gradle:依赖关系
并检查 providedCompile
部分。在我的情况下,它是 validation-api
作为gwt-user的子依赖。
+ --- com.google.gwt:gwt-user:2.5.1
| + --- javax.validation:validation-api:1.0.0.GA
| \ --- org.json:json:20090211
+ --- com.google.gwt:gwt-dev:2.5.1
| \ --- org.json:json:20090211
\ --- javax.servlet:servlet-api:2.5
它是应用程序所必需的,它的jar被移除了,导致了WAR。
要坚持它们,我必须在构建中编写以下代码.gradle:
providedCompile(com.google.gwt:gwt-user:$ gwtVersion){
transitive = false;
}
providesCompile(com.google.gwt:gwt-dev:$ gwtVersion){
transitive = false;
}
并且一切正常。
I assemble WAR for GWT application through gradle.
When GWT is included like
dependencies {
compile "com.google.gwt:gwt-user:2.5.1"
compile "com.google.gwt:gwt-dev:2.5.1"
...
}
then I have gwt-user.jar and gwt-dev.jar in resulting WAR file. They are not really needed and are big. If I delete these jars from WAR - application works well.
But when I try to assemble WAR without these jars inside using
dependencies {
providedCompile "com.google.gwt:gwt-user:2.5.1"
providedCompile "com.google.gwt:gwt-dev:2.5.1"
...
}
then the application cannot start in tomcat saying
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [application-context.xml]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
and other strange error messages.
How can I correctly exclude just gwt-user and gwt-dev jars from gradle build?
解决方案 Other jars that are listed in compile
section did disappear from WAR too. It can be quickchecked (you may not assemble the whole war) with
gradle :dependencies
and checking providedCompile
section. In my case it was validation-api
as subdependency of gwt-user.
+--- com.google.gwt:gwt-user:2.5.1
| +--- javax.validation:validation-api:1.0.0.GA
| \--- org.json:json:20090211
+--- com.google.gwt:gwt-dev:2.5.1
| \--- org.json:json:20090211
\--- javax.servlet:servlet-api:2.5
It is required by the app and its jar was removed resulting WAR.
To persist them, I had to write the following in build.gradle:
providedCompile ("com.google.gwt:gwt-user:$gwtVersion") {
transitive = false;
}
providedCompile ("com.google.gwt:gwt-dev:$gwtVersion") {
transitive = false;
}
and everything went ok.
这篇关于为gwt-user / dev提供gradle provideCompile会导致其他jar从WAR中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文