eclipse中的maven管理之外掛程式的配置(六)

來源:互聯網
上載者:User


parent中的pom

  <build>  <pluginManagement>  <plugins>  <plugin>  <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-source-plugin</artifactId>           <version>2.1.2</version>           <executions>           <execution>           <phase>package</phase>           <goals><goal>jar-no-fork</goal></goals>           </execution>           </executions>  </plugin>    <plugin>  <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-rar-plugin</artifactId>        <version>2.2</version>        <executions>        <execution>        <phase>package</phase>        <goals><goal>rar</goal></goals>        </execution>        </executions>  </plugin>    <plugin>  <groupId>org.codehaus.mojo</groupId>        <artifactId>sql-maven-plugin</artifactId>       <version>1.5</version>       <dependencies>       <dependency>       <groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.18</version>       </dependency>       </dependencies>       <configuration>         <driver>${mysql.driver}</driver>          <url>${mysql.url}</url>          <username>${mysql.username}</username>          <password>${mysql.password}</password>          <sqlCommand>          create database IF NOT EXISTS maven_test          </sqlCommand>       </configuration>              <executions>       <execution>       <phase>package</phase>       <goals>       <goal>execute</goal>       </goals>       </execution>       </executions>  </plugin>  </plugins>  </pluginManagement>  </build>

在模組中調用:

  <build>    <finalName>user-web</finalName>        <plugins>    <plugin>    <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-war-plugin</artifactId>        <version>2.2</version>        <configuration>        <warName>hello</warName>        </configuration>    </plugin>        <plugin>  <groupId>org.mortbay.jetty</groupId>  <artifactId>jetty-maven-plugin</artifactId>  <configuration>    <scanIntervalSeconds>10</scanIntervalSeconds>    <webApp>      <contextPath>/kk</contextPath>    </webApp>    <connectors>       <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">          <port>8787</port>          <maxIdleTime>60000</maxIdleTime>       </connector>     </connectors>  </configuration></plugin>    </plugins>  </build>

查詢地址:http://maven.apache.org/plugins/index.html 

常用外掛程式:http://blog.163.com/lizhe_163/blog/static/6733560820119584353752/  

我們項目用到的外掛程式;第一個是為了防止jdk版本問題,第二個是有關test測試的問題

    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <configuration>                    <source>1.6</source>                    <target>1.6</target>                </configuration>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-surefire-plugin</artifactId>                <configuration>                    <skip>true</skip>                    <testFailureIgnore>true</testFailureIgnore>                </configuration>            </plugin>        </plugins>        <defaultGoal>package</defaultGoal>    </build>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.