日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MAVEN项目标准目录结构 ;

發布時間:2024/9/5 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MAVEN项目标准目录结构 ; 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.標準目錄結構:

src

? -main ????? –bin 腳本庫 ????? –java java源代碼文件 ????? –resources 資源庫,會自動復制到classes目錄里 ????? –filters 資源過濾文件 ????? –assembly 組件的描述配置(如何打包) ????? –config 配置文件 ????? – webapp web應用的目錄。WEB-INF、css、js等 ? -test ????? –java 單元測試java源代碼文件 ????? –resources 測試需要用的資源庫 ????? –filters 測試資源過濾庫 ? -site Site(一些文檔) target LICENSE.txt Project’s license README.txt Project’s readme
工程根目錄下就只有src和target兩個目錄
target是有存放項目構建后的文件和目錄,jar包、war包、編譯的class文件等。

target里的所有內容都是maven構建的時候生成的

參照:http://breath.iteye.com/blog/1005447

++++++++++++++++++++++++++++++++++++++++++++

Maven項目的標準目錄介紹

?

Maven提倡使用一個共同的標準目錄結構,使開發人員能在熟悉了一個Maven工程后,對其他的Maven工程也能清晰了解。這樣做也省去了很多設置的麻煩。

以下的文檔介紹是Maven希望的目錄結構,并且也是目錄創建工程是采用的目錄結構。Maven推薦大家盡可能的遵守這樣的目錄結構。

src/main/Java

Application/Library sources

src/main/resources

Application/Library resources

src/main/filters

Resource filter files

src/main/assembly

Assembly descriptors

src/main/config

Configuration files

src/main/webapps

Web application sources

src/test/java

Test sources

src/test/resources

Test resources

src/test/filters

Test resource filter files

src/site

Site

LICENSE.txt

Project's license

README.txt

Project's readme

在頂級目錄上是工程的描述文件pom.xml(如果使用Ant則還包括其他屬性文件,maven.xmlbuild.xml,另外還包括提供給最終用戶的文件,如,README.txt,LICENSE.txt等等。

?

頂級目錄還包括兩個子目錄:src,target。頂級目錄下可能出現的其他目錄僅僅是CVS或.svn和其他多模塊工程的工程目錄,最好不要再有其他目錄。

?

Target目錄是所有工程編譯構建的輸出目錄。

?

Src目錄包含所有工程的源碼文件,配置文件,資源文件等等。它下面的子目錄一般包含main(主要的工程源文件),test(測試文件),site(項目站點文件)。

?

項目構建的生命周期的介紹

?

Maven 2是圍繞著構建生命周期概念設計的。這意味著,構建或者發布的過程已經被清晰的定義了。

當我們使用Maven構建工程時,我們只需要了解幾個Maven定義好的命令即可,其他的工作則交給POM來完成。

以下給出Maven提供的構建生命周期列表:

validate

validate the project is correct and all necessary information is available.

generate-sources

generate any source code for inclusion in compilation.

process-sources

process the source code, for example to filter any values.

generate-resources

generate resources for inclusion in the package.

process-resources

copy and process the resources into the destination directory, ready for packaging.

compile

compile the source code of the project.

process-classes

post-process the generated files from compilation, for example to do bytecode enhancement on?Java?classes.

generate-test-sources

generate any test source code for inclusion in compilation.

process-test-sources

process the test source code, for example to filter any values.

generate-test-resources

create resources for testing.

process-test-resources

copy and process the resources into the test destination directory.

test-compile

compile the test source code into the test destination directory

test

run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.

package

take the compiled code and package it in its distributable format, such as a JAR.

pre-integration-test

perform actions required before integration tests are executed. This may involve things such as setting up the required environment.

integration-test

process and deploy the package if necessary into an environment where integration tests can be run.

post-integration-test

perform actions required after integration tests have been executed. This may including cleaning up the environment.

verify

run any checks to verify the package is valid and meets quality criteria.

install

install the package into the local repository, for use as a dependency in other projects locally.

deploy

done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

因此,當我們構建一個項目時,只需要了解自己希望做什么,然后執行以上對應的生命周期即可。

?

例如,我們希望編譯我們的工程。在命令行狀態下進入到工程的pom.xml文件所在的目錄中,使用命令:mvn compile;希望構建打包我們的工程,使用mvn package即可。

?

當然了,maven的構建生命周期也是可以擴展和自定義的,這里就先不做介紹了。

?

參照:http://hi.baidu.com/mylovechangchu/blog/item/fbda36da3644a6dfb6fd48d6.html

+++++++++++++++++++++++++++++++

APACHE原址:http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

轉載于:https://www.cnblogs.com/linbo3168/p/6541250.html

總結

以上是生活随笔為你收集整理的MAVEN项目标准目录结构 ;的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。