軟件是對質量的不懈追求

          Building Standalone Application with Maven2

          If you are building standalone application in Java, Maven is your friend when packing your application,
          There are two way to let Maven package your application, either as a single jar with all your dependencies jar.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
             <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
             </descriptorRefs>
            </configuration>
           </plugin>



          One advantage if you choose to do this way is if you need to sign your application jar.
          This is needed if you are building a Java Web Start client and you need more access than connecting back to the server.
          To read more about have Maven signing your jar read http://maven.apache.org/plugins/maven-jar-plugin/usage.html.
          But if you choose to go this way, make sure that all license agreement are shipped with your one single jar.

          Another way is to let Maven package your source code only and then referring the dependent jar file from the MANIFEST file.


           <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
             <archive>
              <manifest>
               <addClasspath>true</addClasspath>
               <mainClass>se.msc.adapter.Main</mainClass>
               <classpathPrefix>lib/</classpathPrefix>
              </manifest>
             </archive>
            </configuration>
           </plugin>

          posted on 2011-02-24 13:03 BlakeSu 閱讀(332) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 盐山县| 盖州市| 连城县| 平利县| 云霄县| 嘉义市| 岑溪市| 武乡县| 乌拉特后旗| 合作市| 霍林郭勒市| 霍山县| 荆门市| 松潘县| 南部县| 福泉市| 勐海县| 仁布县| 三原县| 大方县| 阳信县| 蓬安县| 耒阳市| 沂南县| 江都市| 收藏| 宁陕县| 临颍县| 萍乡市| 微博| 赫章县| 靖江市| 横山县| 抚远县| 博乐市| 无锡市| 呈贡县| 手机| 林州市| 花莲县| 河曲县|