idea在maven环境下部署ssm项目到

1、

web.xml(注意plugins位置)

<?xml version="1.0" encoding="UTF-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">
    <parent>
        <artifactId>ssmtest</artifactId>
        <groupId>com.cnstrong</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>web</artifactId>
    <packaging>war</packaging>

    <name>web Maven Webapp</name>
    <!-- FIXME change it to the project's website -->
    <url>http://www.example.com</url>

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

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.cnstrong</groupId>
            <artifactId>service</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>web</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
            </plugins>

        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <!-- 指定端口 -->
                    <port>9101</port>
                    <!-- 请求路径 -->
                    <path>/</path>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

2、

3、出现的问题:Maven多模块项目单独编译子模块项目时报错:Failed to execute goal on project/Could not resolve dependencies for project

解决方法:需要把parent工程,也就是package是pom的那个工程先install一下;之后再install公共引入的模块,最后就可以单独编译子模块。(或许可以尝试:2、不用install,直接编译parent项目;这种方式只能在parent项目下进行,不能单独编译子模块。我没试过)

4、

"C:\Program Files\Java\jdk1.8.0_131\bin\java.exe" -Dmaven.multiModuleProjectDirectory=F:\ssmtest\web -Xms128m -Xmx512m -Duser.language=zh -Dfile.encoding=UTF-8 -Dmaven.home=E:\maven-3.6.1\apache-maven-3.6.1 -Dclassworlds.conf=E:\maven-3.6.1\apache-maven-3.6.1\bin\m2.conf -Didea.launcher.port=63852 "-Didea.launcher.bin.path=E:\idea\IntelliJ IDEA 2018.1.4\bin" -classpath "E:\maven-3.6.1\apache-maven-3.6.1\boot\plexus-classworlds-2.6.0.jar;E:\idea\IntelliJ IDEA 2018.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMainV2 org.codehaus.classworlds.Launcher -Didea.version=2018.1.4 --update-snapshots -s E:\maven-3.6.1\apache-maven-3.6.1\conf\settings.xml -Dmaven.repo.local=E:\maven-3.6.1\maven-repository tomcat7:run
[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...ion\n   |       variables for plugins in the POM.\n   |\n   |-->\n  <p... @203:5)  @ E:\maven-3.6.1\apache-maven-3.6.1\conf\settings.xml, line 203, column 5
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...ion\n   |       variables for plugins in the POM.\n   |\n   |-->\n  <p... @203:5)  @ E:\maven-3.6.1\apache-maven-3.6.1\conf\settings.xml, line 203, column 5
[WARNING] 
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.cnstrong:web >--------------------------
[INFO] Building web Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ web >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ web ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ web <<<
[INFO] 
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ web ---
[INFO] Running war on http://localhost:9101/
[INFO] Using existing Tomcat server configuration at F:\ssmtest\web\target\tomcat
[INFO] create webapp with contextPath: 
八月 19, 2019 3:21:44 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-9101"]
八月 19, 2019 3:21:44 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Tomcat
八月 19, 2019 3:21:44 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.47
八月 19, 2019 3:21:51 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
八月 19, 2019 3:21:51 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
八月 19, 2019 3:21:53 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'dispatcherServlet'
八月 19, 2019 3:21:55 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-9101"]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值