软件是对质量的不懈追求

2011年2月24日 #

linux du 查看文件夹占用空间


du -sh *

posted @ 2011-04-15 08:39 BlakeSu 阅读(267) | 评论 (0)编辑 收藏

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 @ 2011-02-24 13:03 BlakeSu 阅读(308) | 评论 (0)编辑 收藏