eclipse中的maven管理之插件的配置(六)


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>


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值