如何在IDEA中配置Tomcat(建议收藏)

在IDEA中配置Tomcat

第一步:选择这个方框
如何在IDEA中配置Tomcat(建议收藏)_第1张图片

第二步:选择+号,找到Tomcat Server(Local)如何在IDEA中配置Tomcat(建议收藏)_第2张图片

如何在IDEA中配置Tomcat(建议收藏)_第3张图片

第三步:将红方框内填完整

如何在IDEA中配置Tomcat(建议收藏)_第4张图片

第四步:创建artifaces,选择Deployment–>Artia…选择 *.war exploded或 * .exploded

如何在IDEA中配置Tomcat(建议收藏)_第5张图片

第五步:选择Application server
如何在IDEA中配置Tomcat(建议收藏)_第6张图片

如何在IDEA中配置Tomcat(建议收藏)_第7张图片

最后点击apply,然后ok

第六步:选择Tomcat 9,点击启动

如何在IDEA中配置Tomcat(建议收藏)_第8张图片




<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0modelVersion>


  
  <groupId>org.examplegroupId>
  <artifactId>javaweb-02-mavenartifactId>
  <version>1.0-SNAPSHOTversion>
  <packaging>warpackaging>

  <name>javaweb-02-maven Maven Webappname>
  
  <url>http://www.example.comurl>


  
  <properties>
    
    <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
    
    <maven.compiler.source>1.7maven.compiler.source>
    <maven.compiler.target>1.7maven.compiler.target>
  properties>


  
  <dependencies>
    
    <dependency>
      <groupId>junitgroupId>
      <artifactId>junitartifactId>
      <version>4.11version>
      <scope>testscope>
    dependency>
  dependencies>


  
  <build>
    <finalName>javaweb-02-mavenfinalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-pluginartifactId>
          <version>3.1.0version>
        plugin>
        
        <plugin>
          <artifactId>maven-resources-pluginartifactId>
          <version>3.0.2version>
        plugin>
        <plugin>
          <artifactId>maven-compiler-pluginartifactId>
          <version>3.8.0version>
        plugin>
        <plugin>
          <artifactId>maven-surefire-pluginartifactId>
          <version>2.22.1version>
        plugin>
        <plugin>
          <artifactId>maven-war-pluginartifactId>
          <version>3.2.2version>
        plugin>
        <plugin>
          <artifactId>maven-install-pluginartifactId>
          <version>2.5.2version>
        plugin>
        <plugin>
          <artifactId>maven-deploy-pluginartifactId>
          <version>2.8.2version>
        plugin>
      plugins>
    pluginManagement>
  build>
project>

Maven仓库:https://mvnrepository.com

Maven由于它的的约定大于配置,可能会遇到我们写的配置文件无法被导出或者生效的问题

解决方案:


<build>
  <resources>
    <resource>

      <directory>src/main/resourcesdirectory>
      <includes>
        <include>**/*.propertiesinclude>
        <include>**/*.xmlinclude>
      includes>
      <filtering>truefiltering>
    resource>
    <resource>
      <directory>src/main/javadirectory>
      <includes>
        <include>**/*.propertiesinclude>
        <include>**/*.xmlinclude>
      includes>
      <filtering>truefiltering>
    resource>
  resources>
build>
        **/*.xml              true         ```

你可能感兴趣的:(JavaWeb,tomcat)