afredlyj / mynote

idea and note
1 stars 0 forks source link

Maven相关 #12

Open afredlyj opened 8 years ago

afredlyj commented 8 years ago

snapshot 使用的坑

maven默认打包,如果遇到快照版, MANIFEST.MF文件中会记录时间戳版本,而maven-dependency-plugin插件默认会把-SNAPSHOT.jar包复制到指定目录,导致服务启动之后找不到依赖包,解决办法如下:

<plugin> 
  <groupId>org.apache.maven.plugins</groupId>  
  <artifactId>maven-dependency-plugin</artifactId>  
  <version>2.8</version>  
  <executions> 
    <execution> 
      <id>copy</id>  
      <phase>package</phase>  
      <goals> 
        <goal>copy-dependencies</goal> 
      </goals>  
      <configuration> 
        <outputDirectory>${project.build.directory}</outputDirectory>  
        <useBaseVersion>false</useBaseVersion> 
      </configuration> 
    </execution> 
  </executions> 
</plugin>
afredlyj commented 8 years ago

mvn archetype:generate 速度缓慢问题

使用Idea创建新的maven项目时,时常会在Generating project in Batch mode时等待,当时Idea状态栏显示一直Running,加上-DarchetypeCatalog=internal 运行参数,archetype-catalog.xml本地获取。

Idea的设置路径如下:

Settings -> Build, Execution, Deployment -> Build Tools -> Maven ->Runner

VM Options中添加-DarchetypeCatalog=internal。 使用时,发现该配置只对当前Window有效,囧。

archetypeCatalog参数指定使用的catalog.xml文件,默认值是remote,local。可选值如下:

详情参见Maven使用archetype生成项目