独立Java SE应用程序的项目目录结构是什么? [英] What is the project directory structure for a standalone Java SE application?

查看:584
本文介绍了独立Java SE应用程序的项目目录结构是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

独立Java SE(基于命令行)的应用程序的标准项目目录结构是什么?



src 文件夹将包含我所有的 .java 文件在正确组织的包裹。除了我有 bin 文件夹将包含我的 .class 文件。



我的项目中有属性文件和XML配置文件。我应该放在哪个目录?我应该创建一个名为 com.myproject.config 的软件包,并将所有 .xml 配置文件放在其中? p>

我想要依赖的jar包与我的最终包一起打包。所以我应该创建一个文件夹(用名称 lib )来保存所有这些 .jar 文件?

解决方案

我建议坚持使用默认 Maven 布局(并且还使用maven作为构建工具)



生产课程/资源:

  src / main / java 
src / main / resources

测试数据和类:

  src / test / java 
src / test / resources

Maven还可以正确地使用所有必需的jar来打包应用程序
(查找maven程序集插件) p>

What is the standard project directory structure of a standalone Java SE (Command Line based) application?

src folder will contain all my .java files in properly organized packages. Other than that I have bin folder which will contain my .class files.

I've Properties files and XML configuration files in my project. In which directory should I place them? Should I create a package named com.myproject.config and place all the .xml config files in that?

I want the dependent jars to be packaged along with my final package. So should I create a folder (say by the name lib) to hold all these .jar files?

解决方案

I would recommend to stick with default Maven layout ( and also use maven as build tool )

Productive classes / resources:

src/main/java
src/main/resources

Test data and classes:

src/test/java
src/test/resources

Maven can also take care to package your application properly with all the necessary jars ( look for maven assembly plugin )

这篇关于独立Java SE应用程序的项目目录结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆