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.
The maven quickstart archetype does NOT create src/main/resources
nor src/test/resources
. There are several explanations:
- As stated by its name, this archetype allows to quickstart a project, it's up to you to shape it.
- Why should this archetype create
src/main/resources
and not, say, src/main/assembly
?
- Creating empty directories was actually not possible during a long time (see ARCHETYPE-57).
In other words, just add src/main/resources/META-INF/persistence.xml
manually if you use this archetype.
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?
You can't with this archetype - and I don't really understand why this is a such big issue.
There is a JPA archetype though:
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
That creates the following bootstrap JPA project:
$ 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