JavaRush /Java Blog /Random EN /IntelliJ IDEA User Guide. Application servers.
theGrass
Level 24
Саратов

IntelliJ IDEA User Guide. Application servers.

Published in the Random EN group
Application servers
IntelliJ IDEA Ultimate поставляется с предустановленной поддержкой большинства популярных проприетарных и открытых serverов приложений, включая GlassFish, WebLogic, JBoss EAP, Wildfly, WebSphere, Tomcat, TomEE, Jetty, Geronimo, Resin и Virgo.
  1. Application Servers To configure a server in a development environment, open Settings → Application Servers and click the Add application server button . The development environment will automatically detect the version of the installed server and prompt you to choose which libraries to add to the list of dependencies if this server is used in the project. IntelliJ IDEA User Guide.  Application servers.  - 1
    • Web facet A very important thing when working with application servers is Web facet . In it, the development environment stores settings related to the web server for each module in the project. These settings include installation handles and web resource roots, and are available under Project Structure → Modules and Project Structure → Facets . IntelliJ IDEA User Guide.  Application servers.  - 2
        Typically you don't need to configure all of this manually. The development environment itself finds descriptors and root resource folders, and prompts you to add them to the settings.
        • Artifacts Artifacts are what the development environment puts on the server when you run your web application using Run configurations . Each artifact has its name, type, the directory in which it is built, and the build type ( Web Application: Archive, Web Application: Exploded, EJB Application: Archive, EJB Application: Exploded, etc.). To configure artifacts, open Project Structure → Artifacts . IntelliJ IDEA User Guide.  Application servers.  - 3
            If you use Maven or Gradle build systems , you don't need to configure artifacts manually. The development environment automatically synchronizes them with the settings of the artifacts defined in the build configuration files.
            • Run settings Run configuration determines how the artifact will be uploaded to the server. IntelliJ IDEA supports two types of launch settings - local ( Local ) and remote ( Remote ). When running locally, a new server instance is launched and the artifact is placed on it. When launched remotely, the artifact is uploaded to an already running remote server. IntelliJ IDEA User Guide.  Application servers.  - 4
                Each application server may have a different set of parameters in the Run configuration . IntelliJ IDEA User Guide.  Application servers.  - 5
                  Один из важных параметров тут - On ‘update’ action, который определяет How обновить ваше приложение на serverе, когда вы хотите выложить новую версию, нажав Ctrl + F10 (Cmd+ F10 для Mac). В зависимости от того что вы выбрали, среда разработки может обновить ресурсы, обновить классы и ресурсы(update resources), выложить заново все приложение(update classes and resources) or рестартовать server (restart the server). Если вы не хотите чтобы каждый раз при запуске проекта всплывало диалоговое окно с выбором того How обновить ваш проект на serverе, вы можете снять галочку Show dialog в настройках, что поможет вам сэкономить массу времени если вы часто перезапускаете ваш проект. Другой важный параметр это On frame deactivation, он определяет How обновить ваше приложение на serverе, когда вы переключorсь из среды разработки (к примеру в браузер). В зависимости от того что вы выберете, среда разработки может обновить ресурсы, обновить классы и ресурсы, or не делать вообще ничего. Таким образом, каждый раз How вы переключаетесь в браузер, ваш проект может автоматически загружаться на server. Не забывайте, что вариант обновления классов и ресурсов доступен только если ваш артифакт не является архивом (Exploded). Для архивов используйте HotSwap. По умолчанию, среда разработки запускает server приложений используя ту версию JRE что настроена для вашего проекта. Но вы можете выбрать и любую другую из установленных. Важной частью любой конфигурации запуска является выкладывание артефакта на server. IntelliJ IDEA User Guide.  Application servers.  - 6 По умолчанию, среда разработки автоматически собирает артифакты перед выкладыванием. Но вы можете перенастроить это поведение во вкладке Before launch окна Run configuration. В настройках удаленного запуска вы также можете указать address и номер порта вашего serverа, на который вы хотите залить проект. IntelliJ IDEA User Guide.  Application servers.  - 7
                  • Запуск и отладка applications После того How вы создадите настройки запуска, вы можете запускать ваше приложение с отладчиком or без с помощью кнопок на панели инструментов, or комбинаций клавиш Shift + F10 для запуска без отладчика, и Shift + F9 с отладчиком. IntelliJ IDEA User Guide.  Application servers.  - 8
                    • Update and HotSwap When you want to make changes to the code of an already running application, we recommend using the Update function , accessible by the keyboard shortcut Ctrl + F10 ( Cmd + F10 for Mac ). As already noted, it is only available if your artifact is not an archive. Depending on your choice, during the update, resources may be re-uploaded or classes and resources may be re-uploaded. If the update is run in debug mode, it uses HotSwap mode . Otherwise, Hot redeployment is used. IntelliJ IDEA User Guide.  Application servers.  - 9
                        If your artifact is an archive, you can only rely on HotSwap , which will automatically be used in debug mode.
                        • Build artifacts In order to build artifacts of your project, you need to run Build → Build artifacts in the development environment . IntelliJ IDEA User Guide.  Application servers.  - 10
                          • Application Server Tools Window Each build configuration appears in the Application Server Tools window, along with the server and artifact types. This window can also be useful when starting/stopping the server and uploading/deleting/configuring artifacts. IntelliJ IDEA User Guide.  Application servers.  - eleven
                            We also recommend that you study Getting Started with Java EE 7 and GlassFish 4.0, which describes how to create, configure, deploy and debug Java EE 7 applications on the GlassFish 4.0 application server . Original article
                            Comments
                            TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
                            GO TO FULL VERSION