Java開發須備技能: Java -> Maven -> JDK -> MySql -> MongoDbhtml
vi /etc/profilejava
export M3_HOME=/opt/maven export PATH=${M3_HOME}/bin:${PATH}
source /etc/profileweb
mvn help:describe -Dplugin=dependency -Dmojo=copy-dependencies -Dfullspring
mvn clean package -Dmaven.test.skip=true
根本記不住,這應該是默認的命令, 寫一個批處理 mvn.jar.bat 放到 windows 下. 執行時: mvn.jarmongodb
網上說了不少,只有它: http://blog.csdn.net/hhb200766/article/details/42168819 好用。 Maven參數有幾千個,與其說強大,不如說笨拙。 添加本地lib文件夾作爲倉庫: <repository> <id>in-project</id> <name>In Project Repo</name> <url>${project.basedir}/lib</url> </repository> 添加引用: <dependency> <groupId>jwd</groupId> <!--自定義--> <artifactId>pzx_entity</artifactId> <!--自定義--> <version>3.0.0</version> <!--自定義--> <!--<scope>system</scope>--> <!--<systemPath>${basedir}/lib/pzx_entity-3.0.0.jar</systemPath> <!–項目根目錄下的lib文件夾下–>--> </dependency> lib文件夾下Jar包格式: /groupId/artifactId/version/artifactId-verion.jar
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> <exclusions> <exclusion> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver</artifactId> </exclusion> <exclusion> <groupId>org.springframework.data</groupId> <artifactId>spring-data-mongodb</artifactId> </exclusion> </exclusions> </dependency>
有時,一個項目中,只能有一個Jar包被引用.像: spring-session 在 entity中引用 spring-session 時, 就要使用: scope provided
http://www.cnblogs.com/fengpingfan/p/5192738.html
http://www.cnblogs.com/winner-0715/p/7495179.htmlapache
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <id>attach-sources</id> <!--意思是在什麼階段打包源文件--> <phase>package</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin>
http://rickgong.iteye.com/blog/2368985windows
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <layout>ZIP</layout> <includes> <include> <groupId>jwd</groupId> <artifactId>shop-entity</artifactId> </include> <include> <groupId>jwd</groupId> <artifactId>shop-orm</artifactId> </include> <include> <groupId>jwd</groupId> <artifactId>shop-mvc-base</artifactId> </include> <include> <groupId>jwd</groupId> <artifactId>shop-web-base</artifactId> </include> </includes> </configuration> </plugin> </plugins> </build>
mvn dependency:copy-dependencies -DoutputDirectory=C:/libsession
運行時:
java -Dloader.path="c:/lib" -jar my-service.jarmvc
:: mvn-jar -f corp mvn clean package -Dmaven.test.skip=true %*
window 下,把文件放到 c:\windows 下 , 以及: C:\Program Files\Git\usr\bin 下。maven