zoukankan      html  css  js  c++  java
  • 【IneliJ 】使用IneliJ IDEA 2016将Java Web项目导出为War包

    本文记录使用IDEA导出war包的过程以及碰到问题的解决办法

    虽说现在改用IDEA进行开发了,但还是用eclipse打war包 ….囧
    这样下去不是办法。。。
    于是今天就试着使用IDEA进行打包。
    项目使用SSH框架,没有用maven管理。


    第一步配置Web Application:Exploded(已经配置的可以跳到第二步):

    打开project structure(默认的快捷键是Ctrl+Alt+Shift+S),依次选择Artifacts》+》Web Application:Exploded》From Module选择项目相应的module:
    project structure设置
    这里写图片描述

    第二步配置Web Application:Archive(也就是war包):

    依次选择Artifacts》+》Web Application:Archive》For xxxxx:war exploded(xxxxx是你第一步配置的名字)
    这里写图片描述
    这里写图片描述

    但是我使用上图的方式导出war包的时候没有class,很奇怪!!
    解决办法 :
    将项目编译的class添加到Web Application:Archive中:
    这里写图片描述

    第三步编译导出

    点击make(默认快捷键Ctrl+F9)       2017版的可以省略这一步
    这里写图片描述

    build artifacts:

    这里写图片描述
    这里写图片描述

    end

    -----------------------------------------接下来推荐两种简单的方式---------------------------

    1.点击项目右边的Maven Project

    2.下面两种方式均可以实现打包

    • 选择tomcat7下面的tomcat7:exec-war或者tomcat7:exec-war-only均可以

    •  选择war下面的war:exploded或者war:war也均可以,war:exploded是打包出目录,相当于将war包自动解压。

    • 选择package也可以实现打包

     pom.xml中配置插件:

            <!-- 配置了很多插件 -->
            <plugins>
    
                <!-- 编译插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
    
                <!-- tomcat插件 -->
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.2</version>
                    <configuration>
                        <port>80</port>
                        <path>/SSM</path>
                    </configuration>
                </plugin>
            </plugins>
  • 相关阅读:
    23种设计模式-原型模式
    23种设计模式-工厂方法模式
    23种设计模式-代理模式
    23种设计模式-装饰模式
    23种设计模式-策略模式
    CSS高度塌陷问题与解决办法
    Java: 多态
    Java: 接口
    Java: 继承
    Java: 单例设计模式
  • 原文地址:https://www.cnblogs.com/qlqwjy/p/8087975.html
Copyright © 2011-2022 走看看