Maven不会将* .gwt.xml文件添加到目标floder [英] Maven doesnt add *.gwt.xml file to target floder
问题描述
< groupId> ru.beleychev< / p>的groupId>
< artifactId>笔记< / artifactId>
< version> 0.0.1-SNAPSHOT< / version>
<包装>战争< / packaging>
<名称>备注< / name>
< description>恢复项目< / description>
< parent>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-parent< / artifactId>
< version> 1.5.4.RELEASE< / version>
< relativePath /> <! - 从存储库查找父级 - >
< / parent>
<属性>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< project.reporting.outputEncoding> UTF-8< /project.reporting.outputEncoding>
< java.version> 1.8< /java.version>
< / properties>
<依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-data-jpa< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-data-rest< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-security< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-thymeleaf< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.security< / groupId>
< artifactId> spring-security-taglibs< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.thymeleaf.extras< / groupId>
< artifactId> thymeleaf-extras-springsecurity4< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-web< / artifactId>
< /依赖关系>
< dependency>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< scope>运行时< / scope>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-tomcat< / artifactId>
< /依赖关系>
< dependency>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter-test< / artifactId>
< scope> test< / scope>
< /依赖关系>
<! - GWT - >
< dependency>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> 2.8.1< / version>
< /依赖关系>
< dependency>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> 2.8.1< / version>
< /依赖关系>
< /依赖关系>
< build>
< finalName> $ {project.artifactId}< / finalName>
< outputDirectory> target / $ {project.artifactId} / WEB-INF / classes< / outputDirectory>
< plugins>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
< version> 2.8.1< / version>
<执行次数>
<执行>
<阶段>过程资源< /阶段>
<目标>
< goal>编译< / goal>
< goal> test< / goal>
< /目标>
< /执行>
< /执行次数>
<配置>
< webappDirectory> $ {project.build.directory} / $ {project.build.finalName}< / webappDirectory>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
<配置>
< source> $ {maven.compiler.source}< / source>
< target> $ {maven.compiler.target}< / target>
< / configuration>
< / plugin>
< / plugins>
< / build>
事情是,建立后我找不到NotesGwtApp.gwt.xml文件:)
有2张照片可以更好地理解。发生了什么事?
我真的不明白为什么会这样...
您看到的行为是Maven的标准。这是因为Maven默认只在 src / main / java
文件夹中查找 .java
文件,而有些工具默认情况下可能包含所有文件,因此会造成混淆。
您需要告诉Maven您的中还有非java资源, src / main / java
文件夹;您可能需要添加一些配置,例如:
< resources>
< resource>
<目录> src / main / java< / directory>
<包括>
< include> ** / *< / include>
< / includes>
<排除>
< exclude> ** / *。java< / exclude>
< /不包括>
< / resource>
< /资源>
I am trying to build spring+gwt project with the next properties:
<groupId>ru.beleychev</groupId>
<artifactId>notes</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>notes</name>
<description>Project for resume</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--GWT-->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<outputDirectory>target/${project.artifactId}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
The thing is that after building i cant find NotesGwtApp.gwt.xml file :) There are 2 pictures for better understanding. What is going on?
I really dont understand why is that...
The behavior you're seeing is standard for Maven. It is because Maven, by default, only looks for .java
files in the src/main/java
folder, while some tools might include all files by default, and hence the confusion.
You need to tell Maven that you also have non-java resources in your src/main/java
folder; you might want to add a piece of config such as:
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
这篇关于Maven不会将* .gwt.xml文件添加到目标floder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!