zoukankan      html  css  js  c++  java
  • 如何在 IDEA 中使用Maven 及 相应插件

    1,Maven 面板

    image

    Root ,相当于 VS 中的 sln ? ,大概可以这样理解吧。

    clean  --> install  这样操作, 所有的项目都会被执行。

    手工操作有点麻烦。换另一种方式

    在控制台执行

    image

    mvn clean install -Dmaven.test.skip=true –X  
    与上面的命令相似的

        mvn install  -Dmaven.test.skip=true -Djar.forceCreation  -X  (试用后感觉这条比clean 好些, clean 会删除文件,如果正在热部署,会产生文件锁定的可能性无法删除,这条暂时还没遇到)

     
    其它的命令还有
    mvn clean compile、mvn clean test、mvn clean package、mvn clean install
     
     
    2,启动WEB容器
     
    一般情况下,推荐使用 集成容器, 为什么呢?在 VS开发中,现在谁不用IIS Express 去运行,调试代码呢?
     
    image
     
    jetty和tomcat 都可以,一般 我用 jetty , 大家都说jetty快, 我也没觉得,心理作用吧。不过, java web 容器的启动真是无语。慢或者出错就启不来了
    另外,我已经将 这两个插件配置成为热部署, (也就是 容器检测到内容的改变,会自动重启加载)
     
    下面是Pom中与之相应的配置节点
     
    <build>
    <plugins>


    <!--tomcat7插件-->
    <!--https://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/run-mojo.html-->
    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>${tomcat7-maven-plugin.version}</version>
    <configuration>
    <path>${tomcat-path.version}</path>
    <port>${tomcat-port.version}</port>
    <uriEncoding>${tomcat-uri-encoding.version}</uriEncoding>
    <url>http://localhost:8080/manager/text</url>
    <server>tomcat7</server>
    <username>admin</username>
    <password>admin</password>
    <contextReloadable>true</contextReloadable>
    <update>true</update>
    </configuration>
    </plugin>

    <!--jetty插件-->
    <!--http://www.eclipse.org/jetty/documentation/9.0.0.M3/jetty-maven-plugin.html-->
    <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>${jetty-plugin.version}</version>
    <configuration>
    <stopKey>foo</stopKey>
    <stopPort>8081</stopPort>
    <connectors>
    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
    <port>${jetty-port.version}</port>
    </connector>
    </connectors>
    <webApp>
    <contextPath>${jetty-path.version}</contextPath>
    </webApp>
    <!--scanIntervalSeconds 可选[秒]。在很短的时间间隔内在扫描web应用检查是否有改变,如果发觉有任何改变则自动热部署。默认为0,表示禁用热部署检查。任何一个大于0的数字都将表示启用。-->
    <scanIntervalSeconds>1</scanIntervalSeconds>
    </configuration>
    </plugin>
    </plugins>
    </build>
  • 相关阅读:
    Linux PHP7的openssl扩展安装
    nginx 413 request entity too large解决办法
    html table表格列数太多添加横向滚动条
    Font Awesome-用CSS实现各种小图标icon
    PHP面试专用笔记精简版
    如何理解PHP的单例模式
    HTTP中的header头解析说明
    9.java.lang.ClassCastException
    7.java.lang.IllegalAccessException
    8. java.lang.ArithmeticException
  • 原文地址:https://www.cnblogs.com/zbw911/p/6249647.html
Copyright © 2011-2022 走看看