Gần đây tôi đã chuyển đổi ứng dụng web GWT của mình (GWT 2.4.0) thành dự án maven.
Tôi đang sử dụng maven 2.2.1, gwt-maven plugin (2.4.0), Eclipse Indigo (3.7) và plugin m2eclipse.Trình xây dựng dự án Maven được gọi mỗi khi tôi thay đổi tệp nguồn (GWT)
Các phụ thuộc và cấu hình chung có vẻ ổn khi biên dịch web-ứng dụng mà không gặp bất kỳ sự cố nào và cũng hoạt động ở chế độ sản xuất.
Điều tương tự cũng áp dụng cho chế độ được lưu trữ.
Tuy nhiên tôi có một hành vi lạ: Khi tôi thay đổi một dòng trong tệp nguồn Java/GWT, yêu cầu Maven Project Builder
và các bước này mất nhiều thời gian (khoảng 10 giây) và nhật thực đôi khi trở nên không sử dụng được trong thời gian này.
Đây có phải là hành vi bình thường của m2eclipse không?
Và nếu có, có cách nào để tăng tốc độ không?
Lưu ý: Tôi phải định cấu hình plugin vòng đời cho m2eclipse. Đây là phần quan trọng của tập tin pom:
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>index.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.gmi.nordborglab.testapp.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<versionRange>[2.4.0,)</versionRange>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Đó là một ý tưởng thú vị. Làm thế nào để bạn kích hoạt xây dựng đầy đủ? Sử dụng pom.xml> Chạy dưới dạng? –
@MartinKersten: Có, nếu tôi gọi lại Eclipse đúng cách. Tôi đã không sử dụng nó trong hơn 2 năm: -P –