`
Roger111
  • 浏览: 48209 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

maven随笔

 
阅读更多

1、原来jetty-maven-plugin是eclipse的。maven-jetty-plugin是codehaus的。

2、打包war时排除不需要的jar:

 

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>${pom.version}</version>
      <optional>true</optional>
      <!-- goes in manifest classpath, but not included in WEB-INF/lib -->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar2</artifactId>
      <version>${pom.version}</version>
      <!-- goes in manifest classpath, AND included in WEB-INF/lib -->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar3</artifactId>
      <version>${pom.version}</version>
      <scope>provided</scope>
      <!-- excluded from manifest classpath, and excluded from WEB-INF/lib -->
    </dependency>
    ...
  </dependencies>
  ...
</project>

 3、maven打包源码:maven-source-plugin

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-source-plugin</artifactId>
		<version>2.2</version>
		<configuration>
			<attach>true</attach>
		</configuration>
		<executions>
		  <execution>
				<id>source</id>
				<goals>
					<goal>jar</goal>
				</goals>
			</execution>
		</executions>
	</plugin>

 

 

4. 上传至本地maven仓库

<distributionManagement>
        <repository>
		<id>nexus-releases</id>
		<name>nexus releases repository</name>
		<url>http://168.1.32.15:8081/nexus/content/repositories/releases/</url>
	</repository>
</distributionManagement>

 

 

5、解决eclipse每次启动更新mvn的问题

给offline打上勾即可。

 

6、mvn archetype:create-from-project 创建一个工程模板。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics