Reputation: 463
I was following the steps(provided to me by someone) to deploy a war file on the JBOSS on Windows which are as follows:
1) I created a folder Verson3
2) Using windows command prompt, I went inside the folder Version3
3) I ran the following command and got BUILD SUCCESS
Y:\myusername\My Documents>cd Version3
Y:\myusername\My Documents\Version3>mvn archetype:generate -DgroupId=com.pkg.DownloadService -DartifactId=DownloadService -DarchetypeArtifactId=maven-archetype-we
bapp -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: Y:\myusername\My Documents\Version3
[INFO] Parameter: package, Value: com.pkg.DownloadService
[INFO] Parameter: groupId, Value: com.pkg.DownloadService
[INFO] Parameter: artifactId, Value: DownloadService
[INFO] Parameter: packageName, Value: com.pkg.DownloadService
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: Y:\myusername\My
Documents\Version3\DownloadService
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.262 s
[INFO] Finished at: 2018-02-22T17:16:11-06:00
[INFO] Final Memory: 15M/161M
[INFO] ------------------------------------------------------------------------
This generated the following directory structure:
Version3
|-- src
| `-- main
| |-- resources
| `-- webapp
| |-- WEB-INF
| | `-- web.xml
| `-- index.jsp
`-- pom.xml
4) Next, I was asked to add the following and remove the JUnit related dependency code from the pom.xml
<repositories>
<repository>
<id>JBoss repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
</dependencies>
5) Another change I did was this in web.xml
:
<!-- Auto scan REST service -->
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<!-- this need same with resteasy servlet url-pattern -->
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
6) Ran following command : mvn clean package
where the pom file was. This created target
folder and war file etc.
The thing I am wondering is that there wasn't any java
file I used anywhere in the above process as per the instructions I received. But I do have a java file where
a JAXRS webservice is defined and the package name mentioned inside that file is com.pkg.DownloadService
. I am wondering if I should consider placing that
java file inside the folder DownloadService
and then run all of the above commands? Because building a war file without any web service doesn't makes sense to me.
Upvotes: 0
Views: 342
Reputation: 783
You should place your DownloadService.java under src/main/java/com/pkg. Following your directory structure, it looks something like:
Version3
|-- src
| `-- main
| |-- java
| | `-- com
| | `-- pkg
| | `-- DownloadService.java
| |-- resources
| `-- webapp
| |-- WEB-INF
| | `-- web.xml
| `-- index.jsp
`-- pom.xml
Upvotes: 1