今天好,
基于此页面,,
我正在使用Eclipse使用AXIS2运行时创建自上而下的Java Bean Web服务。
我的不同是,我正在使用 Red Hat Jboss EAP
作为我的服务器。
完成此操作后,我现在想生成战争文件并部署在另一台Red Hat Jboss服务器中。我可以通过右键单击Eclipse中的项目并将其导出为战争,可以成功地生成战争文件,而战争文件可以成功部署到JNOSS服务器中,并且该服务可以成功上升。
另外,我想尝试使用 gradle
命令来生成战争文件,而不是使用eclipse生成。因此,我运行 gradle Clean Build
命令以生成战争文件。是的,可以生成战争文件,但是如果与我生成的throw eclipse相比,文件大小较小10MB。
而战争通过gradle命令产生,当我部署到JBOSS服务器中后,我将在404中查看服务。
我提取两个战争以进行比较,发现使用命令的一种缺少 axis2-web
库文件夹。
以下是我的屏幕截图:
-
eclipse生成的战争文件以及我提取战争后的3个文件夹:
-
gradle Clean Build
生成的战争文件以及我提取战争后的2个文件夹:
如您所见,一个由gradle命令生成的,缺少 axis2-web
库文件夹,因此我相信这就是为什么部署后可以成功访问它的原因。
以下是我的 build.gradle
:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'application'
mainClassName = "EAIDelegateBeanServiceSkeleton"
repositories {
mavenCentral()
maven {
url "https://packages.confluent.io/maven"
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "com.google.guava:guava:17.0"
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.apache.kafka:kafka-clients:3.1.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'io.confluent:kafka-json-serializer:6.2.0'
compile "org.springframework.kafka:spring-kafka:2.6.13"
compile "org.springframework:spring-web:5.2.19.RELEASE"
testImplementation "junit:junit:4.12"
}
我想寻求有关如何配置的帮助,以便我可以使用 gradle
命令来生成正确的战争文件。
Good day,
Base on this page, https://www.eclipse.org/webtools/community/tutorials/TopDownAxis2WebService/td_tutorial.html,
I am using eclipse to create a Top Down java bean web service, by using Axis2 runtime.
The different of mine, is I am using Red Hat JBoss EAP
as my server.
After done the thing, I am now want to generate the war file and deploy in another Red Hat JBoss server. I can successfully generate the war file by right click on the project in my eclipse and export it as war, and the war file can successfully deploy into Jnoss server and the service can up successfully.
In the other way, I would like to try to use gradle
command to generate the war file, instead of using eclipse to generate. Thus I run gradle clean build
command to generate the war file. Yes, the war file can be generated but the file size lesser 10MB if compare with the one I generate throw eclipse.
And the war generate by gradle command, I will hit 404 when I view the service after I deployed into my Jboss server.
I extract both the war to compare, and found that the one using command is lack of the axis2-web
library folder.
The following is my screen shot:
-
eclipse generated war file and with the 3 folders after I extract the war:

-
gradle clean build
generated war file and with the 2 folders after I extract the war:

As you can see, the one generate by gradle command, lack of the axis2-web
library folder, thus I believe this is why it can be access successfully after deployed.
and the following is my build.gradle
:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'application'
mainClassName = "EAIDelegateBeanServiceSkeleton"
repositories {
mavenCentral()
maven {
url "https://packages.confluent.io/maven"
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "com.google.guava:guava:17.0"
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.apache.kafka:kafka-clients:3.1.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'io.confluent:kafka-json-serializer:6.2.0'
compile "org.springframework.kafka:spring-kafka:2.6.13"
compile "org.springframework:spring-web:5.2.19.RELEASE"
testImplementation "junit:junit:4.12"
}
I would like to ask for help on how can I configure so that I can generate the correct war file by using gradle
command.
我发现该解决方案是在
build.gradle.gradle
的战争下配置WebContent/Web-Inf:I found out the solution is configure the webContent/web-inf under war in
build.gradle
: