我在maven项目网页上阅读了this article,其中列出了不同的目录布局(例如:src / main / resources,用于Application / Library资源).
问题是当我运行以下命令(found here)时:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
未创建src / main / resources / Meta-INF目录.这对我很重要,因为我想要访问该目录中的“persistence.xml”.
我应该在mvn命令中添加一个选项吗?如何自动生成包含“Meta-INF / persistence.xml”文件的“src / main / resources”?
谢谢,
问候
The problem is that when I run the following command (…) the src/main/resources/Meta-INF directory isn’t created. It’s important for me because I’d like to reach the “persistence.xml” that is found in that directory.
maven quickstart原型不会创建src / main / resources,也不会创建src / test / resources.有几种解释:
>正如其名称所述,此原型允许快速启动项目,由您来塑造它.
>为什么这个原型会创建src / main / resources而不是src / main / assembly?
>在很长一段时间内实际上无法创建空目录(参见ARCHETYPE-57).
换句话说,如果使用此原型,只需手动添加src / main / resources / Meta-INF / persistence.xml.
Should I add an option in the mvn command? How can I automatically generate the “src/main/resources” that contains the “Meta-INF/persistence.xml” file?
你不能用这个原型 – 我真的不明白为什么这是一个如此大的问题.
但是有一个JPA原型:
mvn archetype:create \ -DgroupId=com.mycompany.project \ -DartifactId=my-project-domain \ -DpackageName=com.company.project.domain \ -DarchetypeGroupId=com.rfc.maven.archetypes \ -DarchetypeArtifactId=jpa-maven-archetype \ -DarchetypeVersion=1.0.0 \ -DremoteRepositories=http://maven.rodcoffin.com/repo
这创建了以下bootstrap JPA项目:
$tree my-project-domain/ my-project-domain/ ├── pom.xml └── src ├── main │ ├── java │ │ └── com │ │ └── company │ │ └── project │ │ └── domain │ │ └── User.java │ └── resources │ └── Meta-INF │ └── persistence.xml └── test ├── java │ └── com │ └── company │ └── project │ └── domain │ ├── DbUnitDataLoader.java │ └── UserTest.java └── resources └── user.db.xml 16 directories,6 files