简体   繁体   中英

Where do I put META-INF in Gradle?

I'm following the Appsrox tutorial on how to Create an Instant Messaging app using Google Cloud Messaging (GCM) . The differences are that I use Android Studio instead of Eclipse, and Gradle for build automation. I've tried to put META-INF inside 'src/main' folder but I got a warning from Google App Engine:

Warning:No META-INF/persistence.xml files were found in the CLASSPATH of the current thread!

EntityManager crashes during the initialization process, cause it can't find 'persistence.xml'.

I'm looking for a simple answer to what should be a simple issue: where do I put META-INF folder?

In Gradle based project place the META-INF folder containing 'persistence.xml' in '/src/main/resources'. (The same is true for a Maven based project)

Find more about Standard Directory Layout here .

As @naXa suggested, '/src/main/resources' is the default location, and you should normally put it there. But if for some reason that's not practical, you can place it anywhere you want as long as you tell Gradle about it. For example, if you wanted to place the META-INF directory in 'src/main/java', you could write:

// Allow resources to live in same directory as source code
sourceSets.main.resources.srcDirs += ["src/main/java"]
sourceSets.test.resources.srcDirs += ["src/test/java"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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