據我所知,Maven只編譯修改後的文件並將其複製到目標文件夾中。maven build需要太多時間
在我的WebApp文件夾,還有很多賣過的800MB大小的文件。
當我啓動這個命令(mvn包)時。
這需要超過10分鐘對所有資源複製到目標/ ICALL/
[INFO]複製web應用資源[/ DATA1 /工作區/ ICALL/SRC /主/ web應用]
這讓我很煩。
有沒有辦法只複製修改過的文件或新生成的文件?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.byto</groupId>
<artifactId>icall</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>icall Maven Webapp</name>
<url>http://maven.apache.org</url>
<build>
<finalName>icall</finalName>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<escapeString>\</escapeString>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- Unrelated Profiles -->
</profiles>
<properties>
<spring-version>3.1.1.RELEASE</spring-version>
<tiles-version>2.2.2</tiles-version>
<mybatis-version>3.1.1</mybatis-version>
</properties>
<dependencies>
<!-- Lots of Unrelated Dependencies -->
</dependencies>
</project>
下面是我用的包,而不是或安裝Linux的目標文件的bash。但是我不能使用Maven的主要特性Dependency Management。但這對我仍然有好處。
#! /bin/sh
tomcat_path=/usr/local/tomcat
source_path=/data1/workspace/icall
deploy_path=/data1/icall_root
function refresh_source {
# Update source from SVN
echo -e "\n\n** Getting new sources from SVN." &&
svn update &&
# Compile *.java
echo -e "\n\n** Building *.java with Maven." &&
mvn compile -Pdev &&
# Copy only modified files
echo -e "\n\n** copying files from ${source_path}/src/main/webapp to ${deploy_path}." &&
rsync -av --exclude=.svn --exclude=WEB-INF/lib/* --exclude=WEB-INF/classes/* --delete ${source_path}/src/main/webapp/* ${deploy_path}/ &&
echo -e "\n\n** copying files from ${source_path}/library to ${deploy_path}/WEB-INF/lib." &&
rsync -av --delete --delete-excluded ${source_path}/library/* ${deploy_path}/WEB-INF/lib/ &&
echo -e "\n\n** copying files from ${source_path}/target/classes/ to ${deploy_path}/WEB-INF/classes/"
rsync -av --checksum --delete --delete-excluded ${source_path}/target/classes/* ${deploy_path}/WEB-INF/classes/ &&
## Only for development server
cp -f ${deploy_path}/info.jsp ${deploy_path}/data/info.jsp
}
function tomcat_restart {
${tomcat_path}/bin/shutdown.sh &&
sleep 30 &&
${tomcat_path}/bin/startup.sh
}
case "$1" in
restart)
refresh_source &&
tomcat_restart
;;
log)
tail -f ${tomcat_path}/logs/catalina.out
;;
*)
refresh_source
;;
esac
爲什麼src/main/webapp中的資源不在src/main/resources中?此外,目標/ icall文件夾看起來不尋常? – khmarbaise 2012-08-06 07:59:15
你可以發佈你的pom,以幫助你嗎? – 2012-08-06 08:28:26
請看看Pom.xml文件供您參考。謝謝 – 2012-08-07 00:37:34