简体   繁体   English

将Java项目部署到JBoss服务器

[英]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. 为了完成项目,我需要在jBoss服务器上运行文件,并检查错误和其他类似内容。 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. 由于我a)之前从未与jBoss /任何其他服务器相关的东西合作过,并且b)在理解唯一可以与我交谈的人方面有很多困难,因此我落后于该项目。

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). 我应该将我的项目部署到jBoss,但它不是Maven项目(并且我不确定Maven现在是什么,但是我正在查找它,因为这似乎是唯一的方法),并且它不是一个Web项目,我都可以只使用“导出”将其制作成WAR文件(显然)。 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. 我的导师一直说它需要是一个WAR文件(这就是上面的链接与WAR有关的原因),但这没有任何意义,这只是让我感到困惑。 I'm almost 100% certain WAR files have to be web application projects. 我几乎100%肯定WAR文件必须是Web应用程序项目。 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. 此外,当我被“教”使用jBoss时,我没有学过任何有关Maven的知识,也不知道这是否绝对必要。 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. 因此,即使我了解我的工作基础(Java,XML等),我仍需要他了解我所使用的环境。 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. 我需要编译,部署到jBoss,调试,然后我不确定下一步是什么(可能正在提交,是否可以正常工作?我的意思是我在这里是全新的,所以我只是坐在我的裤子旁)。我有要编译的代码,现在只需要部署即可。 So, three questions: 因此,三个问题:

  1. Am I correct in saying that I can't make a WAR file from a java project? 我不能从Java项目制作WAR文件是正确的说法吗? If I am wrong, how do I do that? 如果我错了,该怎么办?
  2. Can I just make a JAR file and use that to deploy? 我可以只制作一个JAR文件并使用它进行部署吗? 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? Maven是否必要? I ask because I was never told about Maven and only recently heard about it (not from my mentor). 我问是因为从未听说过Maven,而只是最近才听说(不是从我的导师那里得知)。 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. 我给人的印象是该项目本身需要基于Maven,并且我可以肯定这些项目不是……但是,我之前从未听说过它,所以我仍在研究它。 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? 我不能从Java项目制作WAR文件是正确的说法吗? 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. 您可以在构建项目时将其打包为war(如果您想使用ant或maven),甚至可以通过Eclipse使用Export-> War文件来打包。 You will need a web.xml to make a war file, which from your comments you already have. 您将需要一个web.xml来制作一个war文件,该文件从您已有的注释中获取。

Can I just make a JAR file and use that to deploy? 我可以只制作一个JAR文件并使用它进行部署吗? 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. 是的,您可以部署一个jar,但是我假设您以某种方式希望能够从JBoss的war或ear项目中访问它。

Is Maven necessary? Maven是否必要? I ask because I was never told about Maven and only recently heard about it (not from my mentor). 我问是因为从未听说过Maven,而只是最近才听说(不是从我的导师那里得知)。 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. 我给人的印象是该项目本身需要基于Maven,并且我可以肯定这些项目不是……但是,我之前从未听说过它,所以我仍在研究它。 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. 不,您根本不需要Maven。 You could do all of this through just Eclipse without needing a build tool, although I wouldn't actively advise that. 您可以仅通过Eclipse来完成所有这些操作,而无需构建工具,尽管我不会积极建议这样做。 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. Maven是您的依赖项管理(以及更多),如果您需要检查很多罐子,则最好使用Maven,但这绝不是至关重要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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