Vaadin 8构建应用程序(WAR文件或其他工件)存储在IntelliJ 2017中的哪个位置?

时间:2017-05-25 05:57:25

标签: maven intellij-idea vaadin war vaadin8

通过简单的Vaadin原型创建Maven应用时:

mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.6 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT

...并通过捆绑的Jetty servlet容器运行,我的内置Web应用程序存储在哪里?是否生成了WAR file?如果是的话,在哪里?

我在使用IntelliJ 2017.1.3的macOS Sierra 10.12.5上使用Java 8 Update 131。

3 个答案:

答案 0 :(得分:2)

据我所知和文档提示,在运行mvn jetty:run时,没有构建任何工件。相反,使用自己的内部机制,maven jetty插件将(重新)加载来自target\classes的编译类

  

运行目标在不必内置到WAR中的webapp上运行。相反,Jetty从其源代码部署webapp。它在Maven默认项目位置中查找webapp的组成部分,但您可以在插件配置中覆盖这些部分。例如,默认情况下它会查找:

     
      
  • $ {project.basedir} / src / main / webapp
  • 中的资源   
  • $ {project.build.outputDirectory}中的类
  •   
  • web.xml in $ {project.basedir} / src / main / webapp / WEB-INF /
  •   
     

该插件会自动确保在部署之前重建类并使其保持最新。如果您更改了类的源代码并且您的IDE会在后台自动编译它,那么插件会选择更改的类。

     

您无需将Web应用程序组装到WAR中,从而在开发周期中节省了时间。调用后,您可以将插件配置为连续运行,扫描项目中的更改并在必要时自动执行热重新部署。您所做的任何更改都会立即反映在正在运行的Jetty实例中,让您快速从编码跳转到测试,而不是经历以下循环:代码,编译,重组,重新部署,测试。

...和(may) use the dependencies from the maven repo

  

<强> *注意   正在运行的Jetty实例及其部署的webapp的类路径由Maven管理,可能并不完全符合您的预期。例如:webapp的依赖jar可能通过本地存储库引用,而不是WEB-INF / lib目录。

在运行插件时,在日志中也可以观察到上面提到的一些信息(使用-X又名debug output on运行maven,提供更多信息):

[INFO] Configuring Jetty for project: vaadin-app
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\tmp\test\vaadin-app\target\classes
[DEBUG] Starting Jetty Server ...
[INFO] Context path = /
[INFO] Tmp directory = D:\tmp\test\vaadin-app\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[DEBUG] Adding artifact vaadin-server-8.0.6.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-sass-compiler-0.9.13.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact sac-1.3.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact flute-1.3.0.gg2.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-shared-8.0.6.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact jsoup-1.8.3.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact gentyref-1.2.0.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-push-8.0.6.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact atmosphere-runtime-2.4.5.vaadin2.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-slf4j-jdk14-1.6.1.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-client-compiled-8.0.6.jar with scope compile for WEB-INF/lib 
[DEBUG] Adding artifact vaadin-themes-8.0.6.jar with scope compile for WEB-INF/lib 
[INFO] web.xml file = null
[INFO] Webapp directory = D:\tmp\test\vaadin-app\src\main\webapp
[INFO] Started Jetty Server

但是,如果您要构建和部署打包战争或爆炸战争,可以使用jetty:run-war

  

此目标首先将您的webapp打包为WAR文件,然后将其部署到Jetty。如果设置非零scanInterval,Jetty会监视您的pom.xml和WAR文件;如果有任何变化,它会重新部署战争。

...和/或jetty:run-exploded

  

运行爆炸的目标首先将您的webapp组装成爆炸的WAR文件,然后将其部署到Jetty。如果设置非零scanInterval,Jetty会监视您的pom.xml,`WEB-INF / lib,WEB-INF /和WEB-INF / web.xml以进行更改并在必要时重新部署。

答案 1 :(得分:1)

执行mvn install后,可以在“target”文件夹中找到.war文件。

答案 2 :(得分:1)

有关Maven War Plugin用法文档的详细信息说明:

调用

mvn package

mvn compile war:war

应生成WAR文件 target/vaadin-app-1.0-SNAPSHOT.war

另外链接vaadin-docs,该enter image description here在执行mvn package

后也说明了这一点
The location of the resulting WAR package should be displayed in the command output.