【发布时间】:2014-11-16 14:54:28
【问题描述】:
我是构建工具的新手,现在使用 Spring 4.0.6 和 Gradle 开发 Web 应用程序。
在运行gradle build时,我得到一个错误说javax.persistence和javax.servlet不能被解析:
包 javax.persistence 不存在 包 javax.servlet 不存在
如何告诉 Gradle 从容器中解析 Java EE 依赖项?我不想在我的项目中添加依赖项,然后在我的 WAR 文件中捆绑 JAR,如 hibernate 和 servlet-api。我想从容器中获取它们,这是 Java EE 容器的主要用途...
我的 build.gradle 文件:
apply plugin: 'war'
repositories {
maven {
url "file://my_internal_maven_repo_server/maven2"
}
}
dependencies {
compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
compile 'org.springframework.security:spring-security-web:3.2.5.RELEASE'
compile 'org.springframework.ldap:spring-ldap-core:2.0.2.RELEASE'
compile 'org.thymeleaf:thymeleaf:2.1.3.RELEASE'
compile 'org.thymeleaf:thymeleaf-spring4:2.1.3.RELEASE'
}
我的规格:
- IDE:Eclipse Juno。
- Java EE 容器:JBoss AS 7.2
- 应用程序格式:WAR(所需的构建结构here)
谢谢
查尔斯
【问题讨论】:
-
虽然曾经在 JBOSS 子系统中拥有这些 jar,但这并不是容器的主要用途。堆栈中有许多容器。
标签: spring maven jakarta-ee gradle