我有一个parent
maven模块和三个子模块的项目:
server
shared
web
这是主项目(又名parent
)pom.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.derp</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>server</module>
<module>shared</module>
<module>web</module>
</modules>
<properties>
<gwtVersion>2.7.0</gwtVersion>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomcat.webport>8082</tomcat.webport>
<tomcat.ajpport>8182</tomcat.ajpport>
<tomcat.context>/parent</tomcat.context>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean install tomcat7:run-war-only</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<!-- IDE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version> <!-- Note 2.8 does not work with AspectJ aspect path -->
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>${tomcat.context}</path>
<port>${tomcat.webport}</port>
<ajpPort>${tomcat.ajpport}</ajpPort>
<systemProperties>
<JAVA_OPTS>-XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>
这是我的整个项目结构:
daniel@DK1L:~/git/GWT2.7MavenEclipse/GWT2.7MavenEclipse$ tree
.
├── pom.xml
├── server
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ │ └── pl
│ │ └── derp
│ │ └── server
│ │ └── GreetingServiceImpl.java
│ └── resources
│ ├── META-INF
│ │ └── persistence.xml
│ └── pl
│ └── derp
│ └── server.gwt.xml
├── shared
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ │ └── pl
│ │ └── derp
│ │ ├── shared
│ │ │ └── FieldVerifier.java
│ │ └── web
│ │ ├── GreetingServiceAsync.java
│ │ └── GreetingService.java
│ └── resources
│ └── pl
│ └── derp
│ └── shared.gwt.xml
├── war
│ └── WEB-INF
│ └── web.xml
├── web
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── pl
│ │ │ └── derp
│ │ │ └── web
│ │ │ ├── Messages.java
│ │ │ └── parent.java
│ │ ├── resources
│ │ │ └── pl
│ │ │ └── derp
│ │ │ ├── parent.gwt.xml
│ │ │ └── web
│ │ │ ├── Messages_fr.properties
│ │ │ └── Messages.properties
│ │ └── webapp
│ │ ├── META-INF
│ │ │ └── context.xml
│ │ ├── parent.css
│ │ ├── parent.html
│ │ └── WEB-INF
│ │ └── web.xml
│ └── test
│ ├── java
│ │ └── pl
│ │ └── derp
│ │ └── web
│ │ └── GwtTestparent.java
│ └── resources
│ └── pl
│ └── derp
│ └── parentJUnit.gwt.xml
└── WebContent
└── META-INF
我想知道我应该把persistence.xml放在哪里?在什么包名称,dir和项目我应该把它?
我使用gwt 2.7
答案 0 :(得分:0)
如果您使用maven结构项目,则应将persistence.xml
文件放入以下目录:
src/main
/java
/com.my.package
/client
/shared
/server
/resources
/META-INF/persistence.xml
答案 1 :(得分:0)