計(jì)算機(jī)程序虛擬的人生
          虛擬世界中的游魂

            這個文檔的作者是夏昕。先看看這個文檔的內(nèi)容,在作出評論!! 
            看了spring初探這一章,給我的感覺就是利用java的反射機(jī)制,和hibernate差不多!!
           
            控制反轉(zhuǎn) IOC(Inversion of control):由容器控制程序之間的關(guān)系,而非傳統(tǒng)實(shí)現(xiàn)中,有程序直接操控。
            依賴注入DI(Dependency injection):組件之間的依賴關(guān)系由容器在運(yùn)行期決定,即由容器動態(tài)的將某種依賴關(guān)系注入到組件中。
           
           依賴注入的特性:依賴注入機(jī)制減輕了組件之間的依賴關(guān)系,同時也大大地提高了組件的可移植性,這意味組件得到重用的機(jī)會將會更多!

           注入主要有:接口方式、參數(shù)方式、構(gòu)造方式,其實(shí)我覺得參數(shù)和構(gòu)造應(yīng)該都屬于參數(shù)傳值的方式。 
           
           什么叫熱部署?
                熱部署指的是配置文件修改后自動被容器讀取,無需重新啟動應(yīng)用服務(wù)器。

          <beans>
               <description>Spring Quick Start</description>
               <bean id="messageSource"
                         class="org.springframework.context.support.ResourceBundleMessageSource">
                     <property name="basenames">
                        <list>
                              <value>messages</value>
                        </list>
                     </property>
                </bean>
          </beans>
          這里聲明了一個名為messageSource的Bean(注意對于Message定義,Bean ID必須為messageSource,這是目前Spring的編碼規(guī)約),對應(yīng)類為ResourceBundleMessageSource,目前Spring中提供了兩個MessageSource接口的實(shí)現(xiàn),即ResourceBundleMessageSourceReloadableResourceBundleMessageSource后者提供了無需重啟即可重新加載配置信息的特性

          注意:實(shí)際上Spring實(shí)用了jdk中的ResourceBundle來讀取配置文件

          對于屬性文件中的國際化中文問題:可以利用JDK中的轉(zhuǎn)碼工具native2ascii.exe來進(jìn)行轉(zhuǎn)換
          posted @ 2009-06-22 15:49 小兄弟(Robbins) 閱讀(243) | 評論 (0)編輯 收藏
           
             從hibernate的概要圖上可以看出hibernate的主要是將對象模型轉(zhuǎn)換成關(guān)系模型的過程。
          第二章看完了,感覺框架中涉及的關(guān)鍵性概念及作用要記住:
          SessionFactory(org.hibernate.SessionFactory)
             針對單個數(shù)據(jù)庫映射關(guān)系經(jīng)過編譯后的內(nèi)存鏡像,是線程安全的(不可變)。它是生成Session的工廠,本身要用到ConnectionProvider。該對象可以在進(jìn)程或集群的級別上,為那些事務(wù)之間可以重用的數(shù)據(jù)提供可選得二級緩存。
          Session(org.hibernate.Session)
             表示應(yīng)用程序與持久存儲層之間交互操作的一個單線程對象,此對象生存期很短。其隱藏了JDBC連接,也是Transaction的工廠。其會持有一個針對持久化對象的必選(第一級)緩存,在遍歷對象圖或者根據(jù)持久化標(biāo)識查找對象時會用到。
          -----------------------------------------------------------------------------------------------------------------
          目前好像沒有什么感覺!!

          什么瞬態(tài)(transient)\什么持久化(persistent)\什么脫管(detached)
          把一個對象說的這么理論化,不知為何???
                                                
          posted @ 2009-06-22 15:12 小兄弟(Robbins) 閱讀(117) | 評論 (0)編輯 收藏
           
              我找來一本《hibernate的參考手冊-翻譯版本》
              我訪問http://www.hibernate.org.cn ,既然目前處于域名轉(zhuǎn)讓???不知何解!可能已經(jīng)不用了,網(wǎng)上有些人說已經(jīng)轉(zhuǎn)向www.javaeye.com上了。
           
             還有個網(wǎng)站:http://www.java99.com/
          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
             例子:
                    使用JAVA 數(shù)據(jù)庫(HSQL DB)

                    運(yùn)行Hibernate所使用的最小的jar為:
                            antlr.jar;cglib.jar;asm.jar;asm-attrs.jar;commons-collections.jar;commons-logging.jar;ehcache.jar;hibernate3.jar;jta.jar;dom4j.jar;log4j.jar
                    其中第三方庫jar需要看自身使用的情況而定。 

           hibernate是通過反射機(jī)制來實(shí)例化javaBean,javaBean中默認(rèn)構(gòu)造函數(shù)是不帶參數(shù)的
           hibernate主要依賴于映射文件將對象模型轉(zhuǎn)換成關(guān)系模型。hibernate的配置文件中的DTD文件放在hibernate3.jar包中。 

           標(biāo)識符生成策略:
          <hibernate-mapping>
            <class name="events.Event" table="EVENTS">
               <id name="id" column="EVENT_ID">
                   <generator class="native"/>
               </id>
            </class>
          </hibernate-mapping>

          native:根據(jù)已配置的數(shù)據(jù)庫(方言)自動選擇最佳的標(biāo)識符生成策略。

          看完了第一章內(nèi)容,感覺所講的東西只是傳達(dá)一個比較初略的了解。其實(shí)第一章內(nèi)容根本沒有很多必要寫出來。
          posted @ 2009-06-22 10:27 小兄弟(Robbins) 閱讀(138) | 評論 (0)編輯 收藏
           
          project
          <project name="" default="" basedir="">
          </project>

          name:工程名稱
          default:構(gòu)建文件中的一個目標(biāo)名,如果在命令行沒有指定目標(biāo),則使用默認(rèn)的目標(biāo)
          basedir:定義工程的根目錄,一般情況下為"."
          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          target
          以下目標(biāo)將編譯一組文件,并將它們打包到一個名為finallib.jar的文件中
          <target name="build-lib">
            <javac srcdir="${src.ejb.dir}:${src.java.dir}"
                       destdir="${build.dir}"
                       debug="on"
                       deprecation="on"
                       includes="**/*.java"
                       excludes="${global.exclude}">
                <classpath>
                   <pathelement location="."/>
                   <pathelemetn location="${lib.dir}/somelib.jar"/>
                </classpath>
             </javac>
             <jar jarfile="${dist}/lib/finallib.jar" basedir="${build.dir}"/>
          </target>
          -------------------------------------------------------------------
          <copy todir="${weblogic.dir}/${weblogic.server.home}/public_html/jsp">
            <fileset dir="${src.www.dir}/jsp"/>
          </copy>
          -------------------------------------------------
          相關(guān)概念:
          特性(property):在構(gòu)建文件中由<property>標(biāo)簽表示的名-值對
          DataType:一類表示復(fù)雜數(shù)據(jù)集合的元素,例如fileset和path
          數(shù)據(jù)元素(data element):這個詞涵蓋了特性和DataType

          property
          <property name="my.first.property" value="ignore me"/>
          <property file="user.properties"/>

          <property name="property.one" value="one"/>
          <property name="property.two" value="${property.one}:two"/>
          --------------------------------------------------------------------
          <path id="classpath">
            <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
            </fileset>
          </path>
          -------------------------------------------------
          <target name="" depends="bot">
           <mkdir dir="${doc.dir}/api"/>
           <javadoc packagenames="irssibot.*"
                          sourcepath="${src.dir}"
                          destdir="${doc.dir}/api"
                          author="true"
                          version="true"
                          use="true">
                 <classpath refid="classpath"/>
              </javadoc>
          </target>
          ------------------------------------------------------------
          <target name="clean">
              <delete>
                  <fileset dir="${build.classes}" includes="**/*.class"/>
              </delete>
           </target>

          <target name="cleanall" depends="clean">
             <delete dir="${build.dir}"/>
             <delete dir="${dist.dir}"/>
             <delete dir="${doc.dir}/api"/>
          </target>
          posted @ 2009-06-19 10:27 小兄弟(Robbins) 閱讀(113) | 評論 (0)編輯 收藏
           
          這一章沒有什么新意。但是有一個點(diǎn)就是網(wǎng)絡(luò)任務(wù)需要關(guān)注一下

          真搞不懂,一本書怎么寫這么多的文字,簡直多余!!
          一個ANT寫這么厚?????
          posted @ 2009-06-18 16:56 小兄弟(Robbins) 閱讀(93) | 評論 (0)編輯 收藏
           

          我看的書籍是<Ant權(quán)威指南>,Ant的開發(fā)者:James Duncan Davidson。對于一些比較重要的內(nèi)容我記錄了下來:
          ANT命令行參考
          ant [option [option...]] [target [target...]]
          option :={-help:顯示描述Ant命令及其選項(xiàng)的幫助信息
                         -projecthelp:顯示包含在構(gòu)建文件中的、所有用戶編寫的幫助文檔。即為各個<target>中description屬  性的文本,以及包含在<description>元素中的任何文本。將有description屬性的目標(biāo)列為主目標(biāo)("Main target"),沒有此屬性的目標(biāo)則列為子目標(biāo)("subtarget")
                         -version:要求Ant顯示其版本信息,然后退出
                         -quiet:抑制并非由構(gòu)建文件中的echo任務(wù)所產(chǎn)生的大多數(shù)信息
                         -verbose:顯示構(gòu)建過程中每個操作的詳細(xì)消息。此選項(xiàng)與-debug選項(xiàng)只能選其一
                         -debug:顯示Ant和任務(wù)開發(fā)人員已經(jīng)標(biāo)志為調(diào)試消息的消息。此選項(xiàng)與-verbose只能選其一
                         -emacs:對日志消息進(jìn)行格式化,使它們能夠很容易地由Emacs的shell模式(shell-mode)所解析;也就是說,打印任務(wù)事件,但并不縮排,在其之前也沒有[taskname]
                         -logfile filename:將日志輸出重定向到指定文件
                         -logger classname:指定一個類來處理Ant的日志記錄。所指定的類必須實(shí)現(xiàn)了org.apache.tools.ant.BuildLogger接口
                         -listener classname:為Ant聲明一個監(jiān)聽類,并增加到其監(jiān)聽者列表中。在Ant與IDE或其他Java程序集成時,此選項(xiàng)非常有用
                         -buildfile filename:指定Ant需要處理的構(gòu)建文件。默認(rèn)的構(gòu)建文件為build.xml
                         -Dproperty=value:在命令行上定義一個特性名--值對
                         -find filename:指定Ant應(yīng)當(dāng)處理的構(gòu)建文件。與-buildfile選項(xiàng)不同,如果所指定文件在當(dāng)前目錄中未找到,-find就要求Ant在其父目錄中再進(jìn)行搜索。這種搜索會繼續(xù)在其祖父目錄中進(jìn)行,直至達(dá)到文件系統(tǒng)的根為止,在此如果文件還未找到,則構(gòu)建失敗
                         }

          posted @ 2009-06-18 13:57 小兄弟(Robbins) 閱讀(143) | 評論 (0)編輯 收藏
           
               突然想學(xué)習(xí)學(xué)習(xí)Java-PetStore2.0,感覺比較有趣,學(xué)習(xí)一個Java-PetStore就涉及到GlassFish2.1、db-Derby-10.1.2.1、IDE-NetBeans6.5.1、Ant1.7.1,一堆的工具,java-PetStore2.0是一個netBeans工程,直接使用NetBeans就可以打開,也可以使用Ant操作;工程中所涉及的服務(wù)器GlassFish和數(shù)據(jù)庫Derby,NetBeans都已經(jīng)為你準(zhǔn)備好了。
               ANT一直都沒有好好的去學(xué)習(xí)過,現(xiàn)在打算先把ANT看看!!


          -------------------------------------------------------------------------------------------
              在開發(fā)的過程中,我們可能需要將生產(chǎn)環(huán)境和調(diào)試環(huán)境分開來,這樣才能保證安全性,但是安裝兩個glassfish又不太可能,因?yàn)樗嫶罅恕A硗庾鰹橐粋€工程發(fā)布也不太方便,每次都要將工程名改來改去,并且綁定的EJB在同一個域內(nèi)里是不能同名的。這樣的話,要改變的東西實(shí)在是太多了。
              我們可有以第三種方法,那就是為glassfish添加另外的domain,一個domain跑我們的真實(shí)環(huán)境,一個domain跑我們的測試環(huán)境,因?yàn)槭峭粋€glassfish,所以也不會存在從測試到真實(shí)環(huán)境的移植問題。以后只要改一個domain就可以了。我們在安裝glassfish的時候,它已經(jīng)默認(rèn)為我們安裝了一個domain,那就是domain1.
              我們查看setup.xml里面可以看出,是如何新建domain的,于是我們把我們需要的一些target提取了出來,見如下。下面的配置里面唯一可能需要改變的就是glassfish安裝目錄這個屬性了,其它可以按照我配的來,也可以自己修改。

          <?xml version="1.0" encoding="UTF-8"?>
          <project name="createDomain" default="create.domain" basedir=".">
          <target name="setEnv">
              
          <property name="domain.name" value="domain3"/>
              
          <property name="admin.user" value="admin"/>
              
          <property name="admin.password" value="adminadmin"/>
              
          <property name="admin.port" value="6848"/>
              
          <property name="instance.port" value="10080"/>
              
          <property name="orb.port" value="5700"/>
              
          <property name="imq.port" value="9676"/>
              
          <property name="https.port" value="10181"/>

              
          <property name="iiop.ssl" value="5821"/>  
              
          <property name="iiop.mutualauth" value="5921"/>  
              
          <property name="jmx.admin" value="10687"/>  

              
          <property name="install.home" value="C:/Program Files/glassfish-v2ur2"/>
              
          <property name="adminpassfile" value="${install.home}/passfile"/>
              
          <property name="ASADMIN" value="${install.home}/bin/asadmin.bat"/>
              
          <echo file="${adminpassfile}" append="false">AS_ADMIN_ADMINPASSWORD=${admin.password}</echo>
          </target>
          <target name="create.domain" depends="setEnv">
              
          <exec executable="${ASADMIN}" failonerror="true">
                  
          <arg line="create-domain" />
                  
          <arg line="--adminport ${admin.port}" />
                  
          <arg line="--instanceport ${instance.port}" />
                  
          <arg line="--user ${admin.user}" />
                  
          <arg line="--passwordfile &quot;${adminpassfile}&quot;" />
                  
          <arg line="--domainproperties orb.listener.port=${orb.port}:jms.port=${imq.port}:http.ssl.port=${https.port}:domain.jmxPort=${jmx.admin}:orb.ssl.port=${iiop.ssl}:orb.mutualauth.port=${iiop.mutualauth}" />
                  
          <arg line="--savelogin" />
                  
          <arg line="${domain.name}" />
              
          </exec>
              
          <delete file="${adminpassfile}" />
          </target>
          </project>


          然后用ant執(zhí)行它就可以了,我這里的執(zhí)行輸出如下:

          C:\Program Files\glassfish-v2ur2>ant
          Buildfile: build.xml

          setEnv:

          create.domain:
               [exec] Using port 6848 for Admin.
               [exec] Using port 10080 for HTTP Instance.
               [exec] Using port 9676 for JMS.
               [exec] Using port 5700 for IIOP.
               [exec] Using port 10181 for HTTP_SSL.
               [exec] Using port 5821 for IIOP_SSL.
               [exec] Using port 5921 for IIOP_MUTUALAUTH.
               [exec] Using port 10687 for JMX_ADMIN.
               [exec] Domain being created with profile:developer, as specified by variabl
          e AS_ADMIN_PROFILE in configuration file.
               [exec] The file in given locale [zh_CN] at: [C:\Program Files\glassfish-v2u
          r2\lib\install\templates\locales\zh_CN\index.html] could not be found. Using def
          ault (en_US) index.html instead.
               [exec] Security Store uses: JKS
               [exec] Domain domain3 created.
               [exec] Login information relevant to admin user name [admin] for this domai
          n [domain3] stored at [C:\Documents and Settings\hadeslee\.asadminpass] successf
          ully.
               [exec] Make sure that this file remains protected. Information stored in th
          is file will be used by asadmin commands to manage this domain.
             [delete] Deleting: C:\Program Files\glassfish-v2ur2\passfile

          BUILD SUCCESSFUL
          Total time: 21 seconds
          C:\Program Files\glassfish-v2ur2>


          這樣我們就可以看到glassfish的domains目錄下面,多出了一個domain3這個文件夾。然后有關(guān)數(shù)據(jù)庫連接池啊什么的,就可以到該目錄下面的config/domain.xml去改了,domain.xml里面的屬性我們以后有時候再好好研究一下。當(dāng)然,我們也可以去glassfish的控制臺進(jìn)行可視化修改,glassfish的控制臺是所有的應(yīng)用服務(wù)器里面做得最好的一個了。訪問的端口就是我們新建domain的時候用到的admin.port的這個屬性。
          posted @ 2009-06-18 10:43 小兄弟(Robbins) 閱讀(742) | 評論 (0)編輯 收藏
           
          三種依賴范圍:compiletestprovided,runtime,test,system

          compile(編譯范圍)

          compile是默認(rèn)的范圍;如果沒有提供一個范圍,那該依賴的范圍就是編譯范圍。編譯范圍依賴在所有的classpath中可用,同時它們也會被打包。

          provided(已提供范圍)

          provided依賴只有在當(dāng)JDK或者一個容器已提供該依賴之后才使用。例如,如果你開發(fā)了一個web應(yīng)用,你可能在編譯classpath中需要可用的Servlet API來編譯一個servlet,但是你不會想要在打包好的WAR中包含這個Servlet API;這個Servlet API JAR由你的應(yīng)用服務(wù)器或者servlet容器提供。已提供范圍的依賴在編譯classpath(不是運(yùn)行時)可用。它們不是傳遞性的,也不會被打包。

          runtime(運(yùn)行時范圍)

          runtime依賴在運(yùn)行和測試系統(tǒng)的時候需要,但在編譯的時候不需要。比如,你可能在編譯的時候只需要JDBC API JAR,而只有在運(yùn)行的時候才需要JDBC驅(qū)動實(shí)現(xiàn)。

          test(測試范圍)

          test范圍依賴在一般的 編譯和運(yùn)行時都不需要,它們只有在測試編譯和測試運(yùn)行階段可用。

          system(系統(tǒng)范圍)

          system范圍依賴與provided類似,但是你必須顯式的提供一個對于本地系統(tǒng)中JAR文件的路徑。這么做是為了允許基于本地對象編譯,而這些對象是系統(tǒng)類庫的一部分。這樣的構(gòu)件應(yīng)該是一直可用的,Maven也不會在倉庫中去尋找它。如果你將一個依賴范圍設(shè)置成系統(tǒng)范圍,你必須同時提供一個systemPath元素。注意該范圍是不推薦使用的(你應(yīng)該一直盡量去從公共或定制的Maven倉庫中引用依賴)。

           
          依賴版本界限:
          (?, ?) 不包含量詞。意思為:?<xx<?
          [?, ?] 包含量詞。意思為:?<=xx<=?
          例如:指定一個依賴界限:JUnit 3.8 - JUnit 4.0
          <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>[3.8,4.0)</version>
          <scope>test</scope>
          </dependency>
          
           
          posted @ 2009-06-07 22:28 小兄弟(Robbins) 閱讀(567) | 評論 (0)編輯 收藏
           
          查看有效的pom—〉mvn help:effective-pom
          ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          Maven中的版本包含了以下部分:主版本,次版本,增量版本,和限定版本號;一個版本中,這些部分對應(yīng)如下的格式:
          <major version>.<minor version>.<incremental version>-<qualifier>
          Maven提供了三個隱式的變量,可以用來訪問環(huán)境變量,POM信息,和Maven Settings.

          env變量:暴露了你操作系統(tǒng)或者shell的環(huán)境變量

          project變量暴露了POM

          settings變量暴露了Maven settings信息。

          除了這三個隱式的變量,你還可以引用系統(tǒng)屬性,以及任何在Maven POM中和構(gòu)建profile中自定義的屬性組
           
          自定義屬性:
          <properties>
          <foo>bar</foo>
          </properties>

           

           

          posted @ 2009-06-07 22:10 小兄弟(Robbins) 閱讀(119) | 評論 (0)編輯 收藏
           

          超級POM
          所有的Maven項(xiàng)目的POM都擴(kuò)展自超級POM。你可以在${M2_HOME}/lib中的maven-2.0.9-uber.jar文件中找到pom-4.0.0.xml
          超級pom:
          <project>
            <modelVersion>4.0.0</modelVersion>
            <name>Maven Default Project</name>

            <repositories>
              <repository>
                <id>central</id>
                <name>Maven Repository Switchboard</name>
                <layout>default</layout>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
              </repository>
            </repositories>

            <pluginRepositories>
              <pluginRepository>
                <id>central</id>
                <name>Maven Plugin Repository</name>
                <url>http://repo1.maven.org/maven2</url>
                <layout>default</layout>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
                <releases>
                  <updatePolicy>never</updatePolicy>
                </releases>
              </pluginRepository>
            </pluginRepositories>

            <build>
              <directory>target</directory>
              <outputDirectory>target/classes</outputDirectory>
              <finalName>content-zh-0.5</finalName>
              <testOutputDirectory>target/test-classes</testOutputDirectory>
              <sourceDirectory>src/main/java</sourceDirectory>
              <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
              <testSourceDirectory>src/test/java</testSourceDirectory>
              <resources>
                <resource>
                  <directory>src/main/resources</directory>
                </resource>
              </resources>
              <testResources>
                <testResource>
                  <directory>src/test/resources</directory>
                </testResource>
              </testResources>
            </build>

                <pluginManagement>
                 <plugins>
                   <plugin>
                     <artifactId>maven-antrun-plugin</artifactId>
                     <version>1.1</version>
                   </plugin>      
                   <plugin>
                     <artifactId>maven-assembly-plugin</artifactId>
                     <version>2.2-beta-1</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-clean-plugin</artifactId>
                     <version>2.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>2.0.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-dependency-plugin</artifactId>
                     <version>2.0</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-deploy-plugin</artifactId>
                     <version>2.3</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-ear-plugin</artifactId>
                     <version>2.3.1</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-ejb-plugin</artifactId>
                     <version>2.1</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-install-plugin</artifactId>
                     <version>2.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-jar-plugin</artifactId>
                     <version>2.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <version>2.4</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-plugin-plugin</artifactId>
                     <version>2.3</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-rar-plugin</artifactId>
                     <version>2.2</version>
                   </plugin>
                   <plugin>               
                     <artifactId>maven-release-plugin</artifactId>
                     <version>2.0-beta-7</version>
                   </plugin>
                   <plugin>               
                     <artifactId>maven-resources-plugin</artifactId>
                     <version>2.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-site-plugin</artifactId>
                     <version>2.0-beta-6</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-source-plugin</artifactId>
                     <version>2.0.4</version>
                   </plugin>        
                   <plugin>
                      <artifactId>maven-surefire-plugin</artifactId>
                      <version>2.4.2</version>
                   </plugin>
                   <plugin>
                     <artifactId>maven-war-plugin</artifactId>
                     <version>2.1-alpha-1</version>
                   </plugin>
                 </plugins>
               </pluginManagement>
           
            <reporting>
              <outputDirectory>target/site</outputDirectory>
            </reporting>
          </project>

          1).默認(rèn)的超級POM定義了一個單獨(dú)的遠(yuǎn)程Maven倉庫,ID為central,這是所有Maven客戶端默認(rèn)配置訪問的中央Maven倉庫;該配置可以通過一個自定義的settings.xml文件來覆蓋,注意這個默認(rèn)的超級POM關(guān)閉了從中央Maven倉庫下載snapshot構(gòu)件的功能。如果你需要使用一個snapshot倉庫,你就要在你的pom.xml或者settings.xml中自定義倉庫設(shè)置.
          2)build元素設(shè)置Maven標(biāo)準(zhǔn)目錄布局中那些目錄的默認(rèn)值.
          3)POM中定義的groupIdartifactIdversion:這三項(xiàng)是所有項(xiàng)目都需要的坐標(biāo)

          groupId

          一個groupId歸類了一組相關(guān)的構(gòu)件。組定義符基本上類似于一個Java包名。例如:groupId org.apache.maven是所有由Apache Maven項(xiàng)目生成的構(gòu)件的基本groupId。組定義符在Maven倉庫中被翻譯成路徑,例如,groupId org.apache.maven可以在repo1.maven.org/maven2/org/apache/maven目錄下找到。

          artifactId

          artifactId是項(xiàng)目的主要定義符。當(dāng)你生成一個構(gòu)件,這個構(gòu)件將由artifactId命名。當(dāng)你引用一個項(xiàng)目,你就需要使用artifactId來引用它。artifactIdgroupId的組合必須是唯一的。換句話說,你不能有兩個不同的項(xiàng)目擁有同樣的artifactIdgroupId;在某個特定的groupId下,artifactId也必須是唯一的。

          version

          當(dāng)一個構(gòu)件發(fā)布的時候,它是使用一個版本號發(fā)布的。該版本號是一個數(shù)字定義符如“1.0”,“1.1.1”,或“1.1.2-alpha-01”。你也可以使用所謂的快照(snapshot)版本。一個快照版是一個處于開發(fā)過程中的組件的版本,快照版本號通常以SNAPSHOT結(jié)尾;如,“1.0-SNAPSHOT”,“1.1.1-SNAPSHOT”,和“1-SNAPSHOT”。Section 9.3.1, “項(xiàng)目版本”介紹了版本和版本界限。


           

          posted @ 2009-06-07 21:50 小兄弟(Robbins) 閱讀(283) | 評論 (0)編輯 收藏
          僅列出標(biāo)題
          共3頁: 上一頁 1 2 3 下一頁 
           
          主站蜘蛛池模板: 绩溪县| 衡阳市| 墨玉县| 祁东县| 广丰县| 青海省| 沙洋县| 潮州市| 无极县| 崇明县| 文登市| 抚州市| 陆丰市| 定安县| 吉首市| 蕉岭县| 金溪县| 安达市| 阿克陶县| 岳池县| 沈丘县| 睢宁县| 聂拉木县| 夏津县| 临沧市| 岱山县| 林周县| 扶沟县| 庆城县| 龙口市| 加查县| 巨鹿县| 颍上县| 康定县| 囊谦县| 牡丹江市| 夏津县| 惠东县| 邓州市| 枣庄市| 乐陵市|