【问题标题】:IntelliJ community can't find Web Application Artifact to generate WARIntelliJ 社区找不到 Web 应用程序工件来生成 WAR
【发布时间】:2016-11-07 15:54:17
【问题描述】:

我正在使用 IntelliJ-IDEA Community Edition 从 Maven-Project 生成 war 文件。

在生成这个战争文件时,我在工件中找不到战争选项。

我尝试过:

1) 转到File>Project Structure>Artifacts>Type,但是没有提到WAR;

2) 右键Project Module > add Framework Support,但是Web Application没有提到(我只有Groovy、Kotlin(Java)、Kotlin(JavaScript) .

这是我的 pom.xml 文件:

    <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>

我该如何前进?

【问题讨论】:

  • 您想使用哪个版本?你能告诉我们更多关于你的 pom.xml 的信息吗?有没有设置 maven 插件之类的?

标签: java spring intellij-idea spring-boot


【解决方案1】:

您正在寻找正确的位置(文件>项目结构>工件),但这不是 IntelliJ IDEA 社区版的功能

Artifacts 在终极版中的外观如下:

然而——当我使用 Community Edition 打开同一个项目时:

你将不得不直接使用 Maven 包:

这会将一个人工制品输出到您的target 文件夹。

【讨论】:

    【解决方案2】:

    试试这个:

    • 在 IntelliJ 窗口右上角搜索 Maven 项目
    • 在生命周期选项卡中选择您喜欢的构建

    希望这是您正在寻找的解决方案!

    【讨论】:

    • 我发了一张图片,如果你能看的话!非常感谢你的努力。我仍然有问题,没有找到战争神器以及 springboot 的未知插件(如您在图像上看到的那样)。
    • 双击包应该会生成war(我猜是在目标文件夹中)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    • 2012-10-18
    • 1970-01-01
    • 2020-01-29
    相关资源
    最近更新 更多