简体   繁体   English

哪个 maven Archetype 用于独立的 Java 项目

[英]which maven Archetype to use for standalone java project

I am planing to create a maven project to develop a batch program that can be scheduled in windows system.我打算创建一个maven项目来开发一个可以在windows系统中调度的批处理程序。

here is my requirement.这是我的要求。

  1. there is no database interaction没有数据库交互
  2. need to read xml data and send email using log4j需要使用 log4j 读取 xml 数据并发送电子邮件
  3. build jar of the java project.构建java项目的jar。
  4. thinking to use spring OXM with JAXB考虑在 JAXB 中使用 spring OXM
  5. need to create .bat file so that it will be schedule using windows task manager for to run it every 2 hours.需要创建 .bat 文件,以便使用 Windows 任务管理器安排它每 2 小时运行一次。 so I am planing to have a project such that the data configured in xml will be outside of my jar.所以我计划有一个项目,以便在 xml 中配置的数据将在我的 jar 之外。

please advise which Archetype to select and help on my requirement.请建议选择哪种原型并帮助满足我的要求。

您应该使用maven-archetype-simple创建简单的 jar 项目

您应该运行以下命令

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

If you are using Eclipse, then while creating a maven project from wizard it will give one check box on top which says "Create a simple maven project.........".如果您使用的是 Eclipse,那么在从向导创建 maven 项目时,它会在顶部显示一个复选框,上面写着“创建一个简单的 maven 项目.........”。 You can select this if you are confuse with what type to select如果您对选择什么类型感到困惑,可以选择此项

You may want to consider java-archetype : it has reasonable defaults for quickly starting a Java project following best practices.您可能需要考虑java-archetype :它具有合理的默认值,可以按照最佳实践快速启动 Java 项目。 It can be considered a modern successor of maven-archetype-quickstart.它可以被认为是 maven-archetype-quickstart 的现代继承者。

Disclaimer: I am the author.免责声明:我是作者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM