eclipse 是否可以采用 IntelliJ IDEA 社区版进行 Web 开发?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5553672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:06:49  来源:igfitidea点击:

Is it possible to adopt IntelliJ IDEA Community Edition for web-development?

javaeclipseideintellij-idea

提问by hades

Currently I'm using IntelliJ IDEA for non-web projects, but I'd love to use it for web development. Unfortunately IntelliJ IDEA Ultimate Edition's price (220 Euro) is to high for me currently and that's why I'm forced to use STS(Springsource Tool suite).

目前我正在将 IntelliJ IDEA 用于非 Web 项目,但我很乐意将其用于 Web 开发。不幸的是,IntelliJ IDEA Ultimate Edition 的价格(220 欧元)目前对我来说太高了,这就是我被迫使用 STS(Springsource 工具套件)的原因。

And I'm wondering is there a way to adopt IntelliJ IDEA CE version for web-development? Of course I could just use crack or write one but it's not my style.

我想知道有没有办法采用 IntelliJ IDEA CE 版本进行网络开发?当然我可以只用破解或写一个,但这不是我的风格。

采纳答案by gcooney

Sure it's possible. I mean, it's possible to do web development in a text editor. The real question is what do you lose/how much of a pain it is. Some things that you will need to set up:

当然有可能。我的意思是,可以在文本编辑器中进行 Web 开发。真正的问题是你失去了什么/它有多少痛苦。您需要设置的一些内容:

  • A task to build and deploy your WAR file locally(ant, maven, etc.)
  • To debug your project in IntelliJ CE, you'll need to spend some time setting up a run profile to launch your application server.
  • 在本地构建和部署 WAR 文件的任务(ant、maven 等)
  • 要在 IntelliJ CE 中调试您的项目,您需要花一些时间设置运行配置文件来启动您的应用程序服务器。

Even with that stuff set-up, you'll still be missing any convenience features specific to web development(beans won't automatically show links to relevant xml configurations, getters/setters used for dependency injection will probably show unused method warnings, etc.)

即使设置了这些东西,您仍然会缺少任何特定于 Web 开发的便利功能(bean 不会自动显示指向相关 xml 配置的链接,用于依赖注入的 getter/setter 可能会显示未使用的方法警告等。 )

I'd say whether IntelliJ CE is a reasonable choice for web-development depends on how strongly you prefer IntelliJ to other editors, how comfortable you are with web-development in general(since you won't get any editor suggestions or warnings), and how complex the web components of your project are.

我想说 IntelliJ CE 是否是 Web 开发的合理选择取决于您对 IntelliJ 的偏爱程度而不是其他编辑器,您对 Web 开发的总体感觉如何(因为您不会得到任何编辑器建议或警告),以及您项目的 Web 组件的复杂程度。

回答by Nacho Coloma

EDIT: This answer is now outdated. There is a war plugin in gradlethat can be used directly by IntelliJ. Original contents follow, but please don't do this anymore.

编辑:这个答案现在已经过时了。gradle中有一个war插件,IntelliJ可以直接使用。原始内容如下,但请不要再这样做了。

We were using this gradle file:

我们正在使用这个 gradle 文件:

apply from: 'https://raw.githubusercontent.com/icoloma/gradle-plugins/master/webapp.gradle'

group = 'com.mycompany'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.0.1'
}

Then execute gradle ideaor gradle eclipseto generate a project that can be deployed in IntelliJ Community Edition.

然后执行gradle ideagradle eclipse生成一个可以部署在 IntelliJ Community Edition 中的项目。

The long explanation is available hereand the source code is available as a Github project.

详细解释可在此处获得,源代码可作为Github 项目获得