IntelliJ社区无法找到Web应用程序工件来生成WAR [英] IntelliJ community can't find Web Application Artifact to generate WAR
问题描述
我正在使用 IntelliJ-IDEA社区版从Maven项目生成 war 文件。
I'm using IntelliJ-IDEA Community Edition to generate a war file from a Maven-Project.
当生成这个war文件时,我找不到工件中的war选项。
When it comes to generate this war file I can't find the war option among the artifacts.
我试过:
1)转到文件>项目结构>工件>类型,但未提及WAR;
1) go to File>Project Structure>Artifacts>Type, but WAR is not mentioned;
2 )右键单击项目模块>添加框架支持,但未提及Web应用程序(我只有Groovy,Kotlin(Java),Kotlin(JavaScript)。
2) right click on Project Module > add Framework Support, but Web Application is not mentioned (I only have Groovy, Kotlin(Java), Kotlin (JavaScript).
这是我的pom.xml文件:
This is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mawashi.alex.firstapp</groupId>
<artifactId>firstapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>firstapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--automatic configuration for web applications-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.4.1.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugins</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
<pluginRepository>
<id>jetty</id>
<url>http://mvnrepository.com/artifact/org.eclipse.jetty</url>
</pluginRepository>
</pluginRepositories>
</project>
我该如何前进?
推荐答案
您正在寻找正确的位置(文件>项目结构>工件),但这不是IntelliJ IDEA社区版的功能。
You are looking in the correct place (File>Project Structure>Artifacts), but this is not a feature of IntelliJ IDEA Community Edition.
以下是终极版中神器的样子:
Here's what Artifacts looks like in Ultimate Edition:
然而 - 当我使用Community Edition打开同一个项目时:
Whereas — when I open the same project using Community Edition:
您将不得不直接使用Maven包:
You are going to have to use Maven package directly:
这将输出一个人工制品到目标
文件夹。
This will output an artefact to your target
folder.
这篇关于IntelliJ社区无法找到Web应用程序工件来生成WAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!