Eclipse 搭建 Maven Web 项目

Eclipse 搭建 Maven Web 项目

转自 Eclipse 创建 maven 项目动态 web 工程
发现了一片好文章, 但是浏览量比较少, 转载后希望帮助更多的人. 排版整理, 有少量的内容整理.

一、操作环境

  1. Eclipse Oxygen 4.7.0
    eclipse版本
  2. maven 3.5.0
    maven版本
  3. JDK 1.8.0_20
    jdk版本
  4. Apache Tomcat 7.0
    在这里插入图片描述

二、创建 maven 的 web 项目

  1. 新建项目
    File(或者选择 Eclipse 左侧的 “Package Explorer” 中的某个工作集,右键 ) -> New -> Other,在弹出的对话框中找到 “Maven” -> 选择”Maven Project” -> “Next”
    在这里插入图片描述
    在这里插入图片描述

  2. Next
    在这里插入图片描述

    注:

    此处我是在我的工作集(working set) testWorkSet 上点击右键来创建的项目。因此,会自动将创建项目添加到 Test 工作集。此处不用任何设置,直接 Next 即可。

  3. 选择 maven 项目模板
    在弹出的对话框中找到 Artifact Id 为 “maven-archetype-webapp” 的条目,点击 “Next”
    在这里插入图片描述

    注:

    此处可在 Filter 后的文本框中输入 “webapp” 来进行快速过滤与定位

    如果同一个 Artifact 有多个版本,请选择最新版本(”Show the last version of Archetype only” 勾选了则不会出现多个版本)

  4. 设置 maven 项目信息

    在 “Group Id”,”Artifact Id”,”Package” 后的文本框中设置该项目的信息,然后点击 “Finish”
    在这里插入图片描述

    注:

    • Group Id 的设置一般使用公司或者组织的倒置域名。例如:spring-mvc 项目的 groupId 为 org.springframework,artifactId 为 spring-webmvc
    • Artifact Id 设置为该项目的名称。例如:apache 组织的 tomcat 项目,groupId 为 org.apache,artifactId 为 tomcat
    • Package 是为 maven 项目设置一个包路径。如此处:groupId 为 com.jzl,artifactId 为 mvnweb,则 Package 自动生成为 com.jzl.mvnweb。Package 路径设置也可以不使用默认的规则,完全可以自由设定,甚至为空,不过约定俗成的方式一般是使用公司或者组织的倒置域名加上项目名组成。
    • version 在首次创建的时候保持默认即可,它用来标识项目的版本
    • 此处设置的 groupId、artifactId、version 等信息会在项目创建完成后生成到 pom.xml 配置文件中,并且如果你的项目是需要作为第三方依赖提供给其他人使用,此处设置的信息也对应到对方配置的 pom.xml 中的 标签中的配置。当然,这些信息也可以在项目创建完成以后在 pom.xml 中来更改。
  5. 完成项目创建

    在上一步中点击 “Finish” 后,等待一段时间,项目创建完成,会生成一个如下图所示的项目结构。至此,项目创建完成

    在这里插入图片描述

    注:

    如果是第一次使用 eclipse 的 maven 创建项目,会从 maven 仓库下载一些依赖包,所以可能需要一点时间(取决于网速与电脑配置),请耐心等待(右下角状态栏会有下载的进度条信息)

三、项目配置

配置项目 JRE

在项目创建完成后,在 workspace 中的项目根目录下生成了 .classpath 文件:mvnweb/.classpath,此文件内容如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="target/classes" path="src/main/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	
	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	
	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	
	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
		</attributes>
	</classpathentry>
	
	<classpathentry kind="output" path="target/classes"/>
</classpath>

上面的的文件内容即对应了 mvnweb -> Properties -> Java Build Path -> Source 中的 Source folders,如下所示:

在这里插入图片描述

我们发现 Source 下的 mvnweb/src/main/java 以及 mvnweb/src/test/java 两个 Source 目录前面有红叉,后面有括号显示为 missing,并且 Package Explorer 中也没有显示 src/main/java 以及 src/test/java 这两个 source folder。但当我们右键 mvnweb -> New -> Source Folder -> 填写 “src/main/java” 时显示为已经存在此 Source Folder。

原因是 maven 项目生成的 .classpath 中使用的 JRE_CONTAINER 是 J2SE-1.5,而在 Eclipse 中配置的 Installed JREs 中,设置的 JRE 版本与 1.5 不匹配。

解决方法就是配置正确的 JRE 环境:
右键 mvnweb -> Build Path -> Configure Build Path -> Libraries -> “JRE System Library [J2SE-1.5]” -> Edit

在这里插入图片描述

在弹出的对话框中,选择 “Workspace default JRE(jdk-1.8.0_20)” -> Finish

在这里插入图片描述

注:

  • 也可以使用 Execution environment -> 选择 J2SE-1.8 (jdk-1.8.0_20) 或者 Alternate JRE -> 选择 jdk-1.8.0_20
  • 此处的 “jdk-1.8.0_20” 与你系统中安装的 JDK 以及在 Eclipse 中配置的 JDK 有关,如果使用的其他版本的 JDK,则以安装的 JDK 版本为准

如下: Window -> Preferences -> Java -> Installed JREs

在这里插入图片描述

在设置了正确的 JRE 后,可以看到 Source folders 下面的显示已经正常,而且 Package Explorer 中这两个资源目录也显示出来了

在这里插入图片描述

在这里插入图片描述
可以双击 Source 下的各项属性来配置 Source 属性(当然,你也可以在 mvnweb/.classpath 文件中修改),如 output folder,不过此处保持默认即可:

在这里插入图片描述

在这里插入图片描述

配置 Java 编译器版本 (Java compiler level)

当把 JRE 配置到当前 Eclipse 使用的 JDK 之后,解决了资源目录不显示的问题,但又出现了新问题,可能看到 mvnweb 项目名称前面出现了红叉,而 Problems 视图中则显示了问题的原因(Java 编译器版本不匹配)如下:

在这里插入图片描述
解决方法如下:

(1) 确保 Java Compiler 的版本与 Java Build Path 中的 JRE 版本一致:

mvnweb -> 右键 -> Properties -> Java Compiler -> JDK Compliance -> 确保 Use compliance from execution evironment 已经勾选,并且版本一致。

在这里插入图片描述
注:

此处配置对应 mvnweb/.settings/org.eclipse.jdt.core.prefs 文件,内容如下:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

如果不勾选 “Use compliance from execution evironment”,也可以自行在下方设置 “Java Compiler level”

在这里插入图片描述

(2) 配置 Project Factets 中的 Java Version

mvnweb -> 右键 -> Properties -> Project Facets -> Java -> Version -> 1.8 -> “Apply and close”

在这里插入图片描述

可以看到,mvnweb 项目的错误已经没有了。

(3) 配置 maven compiler 版本(重要)

当你以为配置了上面两部分配置,似乎已经完美解决了问题时,其实这一步才是非常重要,也是最大的一个坑。
双击 mvnweb/pom.xml -> 左下角标签栏 pom.xml,可以看到新创建的 maven 项目除了项目基本信息和一个 junit 的依赖包,并没有其他的设置。那么问题来了,maven 如何实现对项目的打包,更新,编译等等一系列操作的呢?

pox.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>com.jzl</groupId>
  <artifactId>mvnweb</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mvnweb Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>mvnweb</finalName>
  </build>
</project>

答案就在 Effective POM 标签页中,点击 pom.xml 左侧的 Effective POM 标签页,可以看到这个标签页中有很多的 maven 插件。因为 Effective POM 是包含了从 maven 的超级 POM 中继承的元素以及项目配置的 pom 属性。

Effective POM :

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.jzl</groupId>
  <artifactId>mvnweb</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>mvnweb Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <sourceDirectory>D:\eclipseWorkspace\mvnweb\src\main\java</sourceDirectory>
    <scriptSourceDirectory>D:\eclipseWorkspace\mvnweb\src\main\scripts</scriptSourceDirectory>
    <testSourceDirectory>D:\eclipseWorkspace\mvnweb\src\test\java</testSourceDirectory>
    <outputDirectory>D:\eclipseWorkspace\mvnweb\target\classes</outputDirectory>
    <testOutputDirectory>D:\eclipseWorkspace\mvnweb\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory>D:\eclipseWorkspace\mvnweb\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>D:\eclipseWorkspace\mvnweb\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>D:\eclipseWorkspace\mvnweb\target</directory>
    <finalName>mvnweb</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.3.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>default-clean</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <id>default-testResources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
          <execution>
            <id>default-resources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <id>default-war</id>
            <phase>package</phase>
            <goals>
              <goal>war</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>site</phase>
            <goals>
              <goal>site</goal>
            </goals>
            <configuration>
              <outputDirectory>D:\eclipseWorkspace\mvnweb\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
          <execution>
            <id>default-deploy</id>
            <phase>site-deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <outputDirectory>D:\eclipseWorkspace\mvnweb\target\site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>D:\eclipseWorkspace\mvnweb\target\site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <outputDirectory>D:\eclipseWorkspace\mvnweb\target\site</outputDirectory>
  </reporting>
</project>

注:

  • 所有的 POM 都继承自一个 maven 的基类,这个基础的 POM 被称为超级 POM,并包含默认值。
  • Maven 使用 Effective POM (超级 POM 加项目配置的属性) 执行操作。它可以帮助开发人员指定最低配置的详细信息写在 pom.xml 中。
  • 如果在项目的 pom.xml 中没有配置某一属性,那么 maven 在执行操作时就会使用 Effective POM 中从超级 POM 继承的默认配置。而如果项目中配置了某属性,则会直接覆盖超级 POM 中的配置。

说了这么多,问题的关键就在于如果没有在项目的 pom.xml 中配置 maven-compiler-plugin,而 maven 又需要使用此插件,那么 maven 在进行编译时就会使用 Effective POM 中默认的 maven-compiler-plugin 配置,而从上面的截图也可以看到,默认的 compiler-plugin 没有配置编译版本(默认使用的是 JDK 1.5)。因此,当我们进行任何的 maven 操作时,就会将项目的 JDK 版本又设置到 JDK-1.5 的版本,导致我们前面所配置的 JRE,Java Compiler 都失效。

说明:

Maven官方文档有如下描述:

编译器插件用来编译项目的源文件.从3.0版本开始,

用来编译Java源文件的默认编译器是javax.tools.JavaCompiler (如果你是用的是java 1.6) 。

如果你想强制性的让插件使用javac,你必须配置插件选项 forceJavacCompilerUse。
同时需要注意的是目前source选项和target 选项的默认设置都是1.5, 与运行Maven时的JDK版本无> > 关。

如果你想要改变这些默认设置, 可以参考 Setting the -source and -target of the Java Compiler中的描述来设置 source 和target 选项。

这是Maven已知的一个特性。除非在你的POM文件中显示的指定一个版本,否则会使用编译器默认的source/target版本1.5。主要还是在于Eclipse中Maven的集成方式起到了关键作用, 它会从POM文件中生成项目的.project,.classpath以及.settings, 因此除非POM文件指定了正确的JDK版本, 否则你每次更新项目配置的时候它都会重置到1.5版本。

解决方法是

方法一: 在 pom.xml -> project -> build 节点下,添加如下内容:

<plugins>
	<plugin>
	<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<version>3.1</version>
		<configuration>
			<compilerVersion>1.8</compilerVersion>
			<fork>true</fork>
			<source>1.8</source>
			<target>1.8</target>
		</configuration>
	</plugin>
</plugins>

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>com.jzl</groupId>
  <artifactId>mvnweb</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>mvnweb Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>mvnweb</finalName>
    <plugins>
		<plugin>
		<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.1</version>
			<configuration>
				<compilerVersion>1.8</compilerVersion>
				<fork>true</fork>
				<source>1.8</source>
				<target>1.8</target>
			</configuration>
		</plugin>
	</plugins>
  </build>
</project>

注:

  • 如果你的 build 下已经配置过 节点了,那么就在 节点下面添加 部分的内容即可
  • 与 节点配置的版本与上面配置的 JRE 与 Java Compiler 版本一致 (即当前使用的 JDK 版本)

方法二: 修改maven的配置文件 setting.xml

<profile>    
    <id>jdk-1.8</id>    
    <activation>    
        <activeByDefault>true</activeByDefault>    
        <jdk>1.8</jdk>    
    </activation>    
    <properties>    
        <maven.compiler.source>1.8</maven.compiler.source>    
        <maven.compiler.target>1.8</maven.compiler.target>    
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>    
    </properties>    
</profile> 

最后, 右键 mvnweb -> Maven -> Update Proejct,编译版本问题解决

配置 web app version

由于 maven 使用 maven-artchetype-webapp-1.0 创建的 web-app 模板默认的 Dynamic Web Module 版本是 2.3,对应的 servlet 版本比较低,,如下所示:

mvnweb/src/main/webapp/WEB-INFO/web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"; >
<web-app>
	<display-name>Archetype Created Web Application</display-name>
</web-app>

改为:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
	http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
	<display-name>Archetype Created Web Application</display-name>
</web-app>
Proejct Facets

在这里插入图片描述

注:
此处对应的配置文件是 mvnweb/.settings/org.eclipse.wst.common.project.facet.core.xml

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
	<fixed facet="wst.jsdt.web"/>
	<installed facet="jst.web" version="2.3"/>
	<installed facet="wst.jsdt.web" version="1.0"/>
	<installed facet="java" version="1.8"/>
</faceted-project>

由于在操作时发现在 Dynamic Web Module 后面的 Version 处选择 版本 3.0 显示不能从 2.3 转换到 3.0 (此处原因不详,但我把 Dynamic Web Module 前的勾去掉再重新勾选可以转换)。采取直接修改配置文件的方式,将上方的 org.eclipse.wst.common.project.facet.core.xml 改为:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
	<fixed facet="wst.jsdt.web"/>
	<installed facet="jst.web" version="3.0"/>
	<installed facet="wst.jsdt.web" version="1.0"/>
	<installed facet="java" version="1.8"/>
</faceted-project>

然后 右键 mvnweb -> Refresh,可以看到 Project Facets 中的 Dynamic Web Module 已经变成了 3.0 版本

四、eclipse 中运行 maven web 项目

右键 mvnweb -> Run As -> Run on Server -> 选择一个本地配置好的运行时 Server (配置方法见附录二) -> Finish
在这里插入图片描述
在这里插入图片描述
至此,一个完整的,规范的 maven web 项目搭建完成。

附录一:配置 Project Facets Runtimes

在 Project Facets -> Runtimes 中可以配置一个运行时环境,但前提是你必须已经安装有 java web 的运行时环境,比如 tomcat 7,在勾选了运行时环境后,会将运行时环境中的 jar 包加载到项目中。此步骤一般不用设置。
在这里插入图片描述

附录二:配置 Runtimes 环境

运行时环境配置: Window -> Preferences -> Server -> Runtime Environments -> add -> 选择运行时环境及版本(如 apache tomcat v7.0)
在这里插入图片描述
填写一个运行时环境的名字(任意取,只用来做标识用) -> 选择运行时安装的路径 -> 选择 JRE -> Finish
在这里插入图片描述

附录三:修改项目部署组件

右键 mvnweb -> Properties -> Deployment Assembly
在这里插入图片描述

附录四:项目 Eclipse 配置文件

  1. 可以在 eclipse 的 workspace 中的项目目录下找到
    在这里插入图片描述
    在 eclipse 中的 navigator 中查看
    Window -> Show View -> Other -> General -> Navigator -> Open
    在这里插入图片描述
    在这里插入图片描述
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值