简体   繁体   中英

Deploying a Java Project to a JBoss Server

Just so that this doesn't end up marked as a duplicate right off the bat, I did look through the site and find answers to similar questions , but not mine . Although if it turns out there's no answer/this is still a duplicate, I understand.

At my new job, I just got an assignment where I'm using items from a repository. To finish the project, I need to run the files on a jBoss server and check for errors and other stuff like that. Since I a)have never worked with jBoss/any other server related stuff before and b)am having a lot of difficulty understanding the only person who I can talk to about this work, I'm behind on the project.

I'm supposed to deploy my project to jBoss, but it's not a Maven project (and I'm not sure what Maven is right now, but I'm looking it up since it seems to be the only way to do this) and it isn't a web project, both of which I could just use "export" to make into a WAR file (apparently). My mentor keeps saying it needs to be a WAR file (that's why the above links have to do with WARs) but that doesn't make any sense and it's just confusing me. I'm almost 100% certain WAR files have to be web application projects. But, you know... now I'm confused because my mentor is clearly saying WAR and pretty frequently too.

Further, when I was "taught" to use jBoss, I wasn't taught anything about Maven and I don't know if it's absolutely necessary. I'm not trying to do this in the easiest/laziest way... I'm just aware that there's more stuff that I need to learn and I'm trying to learn the most efficient way to do things such that I don't need to keep asking my mentor questions. He's very smart, but very difficult to understand and often leaves me with way, way more questions than answers (and a lot of the time, those new questions are cleared up by my manager with "No, you don't have to do that, it's not necessary, that's not your job, etc."). He's also the only person who I can talk to about my job (and he hasn't been here much longer than me). So even though I understand the basics of my job (Java, XML, etc.) I need him to understand the environment I'm using. He just confuses me when we talk about literally anything else.

I have multiple projects that influence the main project I'm working on. I need to compile, deploy to jBoss, debug, and then I'm not sure what next (probably submit if it's working? I mean I'm literally brand new here so I'm just flying by the seat of my pants.) I've got the code to compile, now I just need to deploy. So, three questions:

  1. Am I correct in saying that I can't make a WAR file from a java project? If I am wrong, how do I do that?
  2. Can I just make a JAR file and use that to deploy? If so, how do I include other projects files in that file (I think the second part is similar to this question , so it's cool to just ignore the second part of this question unless there are different steps. I only ask to be certain).
  3. Is Maven necessary? I ask because I was never told about Maven and only recently heard about it (not from my mentor). I'm getting the impression that the project itself needs to be Maven based and I'm pretty sure these projects aren't... but again, I'd never heard of it before so I'm still looking into it. I feel as though it would've been mentioned, but... I don't know if my mentor just forgot to mention it or if we're just not using it.

Am I correct in saying that I can't make a WAR file from a java project? If I am wrong, how do I do that?

You can wrap the project up as a war when you build it (if you want to use ant or maven), or even doing so through Eclipse using Export -> War file. You will need a web.xml to make a war file, which from your comments you already have.

Can I just make a JAR file and use that to deploy? If so, how do I include other projects files in that file (I think the second part is similar to this question, so it's cool to just ignore the second part of this question unless there are different steps. I only ask to be certain).

Yes you can deploy a jar, but I'm assuming you somehow want to be able to access it from a war or ear project in JBoss.

Is Maven necessary? I ask because I was never told about Maven and only recently heard about it (not from my mentor). I'm getting the impression that the project itself needs to be Maven based and I'm pretty sure these projects aren't... but again, I'd never heard of it before so I'm still looking into it. I feel as though it would've been mentioned, but... I don't know if my mentor just forgot to mention it or if we're just not using it.

No, you don't need maven at all. You could do all of this through just Eclipse without needing a build tool, although I wouldn't actively advise that. Maven is your dependency management (and much more), it's good to use if you have loads of jars you need to keep check of but by no means is it vital.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM