【问题标题】:How to resolve dependencies from Java EE container (JBoss)如何解决来自 Java EE 容器(JBoss)的依赖关系
【发布时间】: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


【解决方案1】:

我的印象是您应该使用 providedCompile 将它们排除在战争之外。

请参阅:http://www.gradle.org/docs/current/userguide/war_plugin.html

http://gesellix.net/providedcompile-and-compile-dependencies-with-gradle/

例如:

providedCompile ("org.jboss.jbossas:jboss-as-client:6.0.0.Final")

How do you integrate gradle and jboss 6 to generate working eclipse projects

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-27
    • 2014-09-06
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2017-04-11
    • 2012-01-31
    • 2023-03-11
    相关资源
    最近更新 更多