Maven目录结构
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
maven基本命令
mvn eclipse:eclipse #生成java项目
mvn eclipse:eclipse -Dwtpversion=1.0 #生成web项目
mvn install -DskipTests #跳过测试
mvn install:install-file -DgroupId=cloud-sign-utils -DartifactId=cloud-sign-utils -Dversion=1.0 -Dpackaging=jar -Dfile=cloud-sign-utils.jar #安装某jar包到本地
下载源码和javadoc命令
mvn install -DdownloadSource=true
mvn install -DdownloadSources=true
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
配置eclipse
Window > Preferences > Maven and checking the "Download Artifact Sources" and "Download Artifact JavaDoc" options
pom.xml模板
${project.build.directory}/lib
Maven创建项目脚本
#!/bin/bash
#项目中文名称
#项目英文名
while read line;do
eval "$line"
done < config
echo $projectNameCn
echo $projectName
# echo $MVN_HOME
#maven-archetype-quickstart (Java Project)
mvn archetype:generate -DgroupId=$projectName'-parent' -DartifactId=$artifactId'-parent' -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DarchetypeCatalog=local
# groupId:包名 artifactId:项目名 archetypeArtifactId:项目类型(模板) interactiveMode:交互模式(默认:true)
# maven-archetype-webapp (Java Web Project)
mvn archetype:generate -DgroupId=$projectName'-app' -DartifactId=$projectName'-app' -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false -DarchetypeCatalog=local
cd $projectName'-parent'
rm -rf src
sed -i "s/
sed -i '/
sed -i '/<\/dependencies>/a