1

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.
Community
  • 1
  • 1
Ice-9
  • 127
  • 2
  • 10
  • do you have a pom.xml in your project? – Lama Mar 19 '14 at 15:23
  • Maven has nothing to do with your problem, so you can rest easy and forget about it. Focus on learning what a WAR is. It might be simpler to do your first tests with Apache Tomcat by the way and not jump directly to a full JEE container such as JBoss. Start small. – Gimby Mar 19 '14 at 15:24
  • @Goot No, I don't. I have a build.xml and a web.xml, but no pom.xml. – Ice-9 Mar 19 '14 at 15:24
  • Since you have absolutely no experience with Jboss, read this book : http://www.amazon.com/JBoss-AS-Configuration-Deployment-Administration/dp/1849516782/. It's fantastic and will give an answer to your questions. I'm kinda new to jboss, too and it was a big help. – Lama Mar 19 '14 at 15:27
  • @Gimby Would Tomcat be significantly different from jBoss? What I mean is, would I need to add/change code that I have right now to use Tomcat? Sorry if this is a really beginner question, I'm just really lost. – Ice-9 Mar 19 '14 at 15:30
  • If you're just deploying a war file, Tomcat would definitely be a better way to go. It's an easier step to make than going to JBoss in my humble opinion. Just drop the war file in the webapps folder of Tomcat and you're done! – David Mar 19 '14 at 15:50

1 Answers1

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?

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.

David
  • 19,577
  • 28
  • 108
  • 128
  • Is it possible to make a WAR file from a warproduct? I only ask because Export>War doesn't seem to work, or maybe I'm just doing it wrong. I'm unsure what steps I should take to make a WAR file using web.xml, I suppose is the more clear way of putting it. – Ice-9 Mar 19 '14 at 15:42
  • If you're using Eclipse, you just have to make a project as a dynamic web project, then the export procedure should work fine, you might want to read http://stackoverflow.com/questions/5108019/how-to-make-war-file-in-eclipse and http://stackoverflow.com/questions/1001714/how-to-create-war-files – David Mar 19 '14 at 15:49
  • The problem is that I'm taking the files from a repository and they're all Java projects. None of them are dynamic web projects, which it seems is the way to do it. I think I could change the project to a dynamic web module, would that be the same thing, essentially? – Ice-9 Mar 19 '14 at 16:00
  • Yeah that would work fine, it gets a little more complicated if they're all separate projects, you'd be better to make the main project you run on Tomcat and try running it from Eclipse, once you get that, it should export as a war. You can mark a project as dynamic web project in the project facade if you go to the properties of the project. – David Mar 19 '14 at 16:02