English 中文(简体)
规划指挥线 Java项目的最佳途径
原标题:Best way to package a command line Java project

I m creating a java command line project, with no GUI. The project uses any number of open source projects : Spring, Logback, Commons CLI etc. When I started to think about packaging, I imagined it would come out as a zip file, that could be exploded to the jar, with a lib sub directory, and dependent jars in the lib.

adapter.jar
 /lib/dependencyA.jar
 /lib/dependencyB.jar 
 etc.  

I ve been playing with Maven Assembly, but it s still not coming out like the above, and I haven t found any examples that do generate the structure above. Is it possible to do so ? In addition, having a multi-module structure adds another layer of complexity that I haven t been able to resolve, as the assembly module can t find the core module as a dependency. This is my first Maven project, so am still learning how Maven works. I ve been through the Sonatype book, but missed something as even using the Best Practices section couldn t get the missing dependency resolved. The examples I ve seen usually involve merging into an uber executable jar, some of which use the Shade project, some don t. My question is, is doing an uber jar including 3rd party libs like Spring etc a good idea ? Or should I persevere with my original zip / lib subdirectory plan ?

最佳回答

您的组装模块是否取决于你想要包装的单元,然后使用“设计”; 独立性 Sets><module 定型号; 标号在你希望的任何布局中。 如果你还有其他一些并非依赖方的档案,你就可以将这些档案放在部署单元本身。

请读到编辑手册。 您可以包装、无包装、包括/排除和批准文件。

如果你看上去有关ven的那类书,这里是相关章节:

EDIT:越狱

问题回答

你只是需要更具体地对待你的大会描述。 只使用一种依赖性Set,其中仅包括主要支柱,将其交付给最高一级,而另一种依赖性Set则只排除了主要支柱,并交付给准继承人。





相关问题
JavaFX with Maven [closed]

I recently started a JavaFX project, and I d like to use Maven as my compiler/deployment tool. Is there a good tutorial or plugin to integrate JavaFX and Maven?

How to upload jar to respository?

I have jar files that cannot be found on Maven Central repository. I would like to add the jar so I can just include extra tag in my pom.xml file and other developer can use the jar. What are the ...

Debug Maven project in Eclipse with third party sources

I am currently developing a maven project in eclipse. The m2eclipse plugin works beautifully. It even works out of the box with debugging. But when I am debugging open source third party libarries. ...

Could Free Pascal benefit of something like Apache Maven?

Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it ...

Run a single test method with maven

I know you can run all the tests in a certain class using: mvn test -Dtest=classname But I want to run an individual method and -Dtest=classname.methodname doesn t seem to work.

Uploading a directory using sftp with Maven

How can I upload a directory - Eclipse update site - using sftp with public key authentication in Maven? For background information: I m using tycho to build an Eclipse plugin and want to get the ...

What are solid NMaven or build servers for .NET alternatives?

Maven had a long history and is well supported in the Java world. NMaven has received a less successful start and has never become as popular in the C#/.NET world as its larger cousin was in the Java ...

热门标签