我已经启动了一个简单的maven模块化应用程序(父和webapp),在netbeans中使用谷歌gwt,似乎我已经开始出现这个错误:
[错误]无法找到类型'com.mycompany.mainproject.adminwebapp.frontend.MainEntryPoint' [错误]提示:以前的编译器错误可能导致此类型不可用
我正在使用netbeans 6.9和我的父pom看起来像这样:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.mainproject</groupId>
<artifactId>admin</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>MAdmin</name>
<url>http://maven.apache.org</url>
......
<modules>
<module>mtbadmin-webapp</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.extjs</groupId>
<artifactId>gxt</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
这是webapp pom:
<dependencies>
<!-- all the parent's pom dependency without version tags are here-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>adminWebapp</finalName>
</build>
<profiles>
<profile>
<id>endorsed</id>
<activation>
<property>
<name>sun.boot.class.path</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<!-- javaee6 contains upgrades of APIs contained within the JDK itself.
As such these need to be placed on the bootclasspath, rather than classpath of the
compiler.
If you don't make use of these new updated API, you can delete the profile.
On non-SUN jdk, you will need to create a similar profile for your jdk, with the similar property as sun.boot.class.path in Sun's JDK.-->
<compilerArguments>
<bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
<tomcat.home>${env.CATALINA_HOME}</tomcat.home>
<web.context>${project.parent.artifactId}</web.context>
</properties>
我的主要入门点类是这样的:
//com.mycompany.mainproject.adminwebapp.frontend
public class MainEntryPoint implements EntryPoint {
public MainEntryPoint() {
}
@Override
public void onModuleLoad() {
final Label lb = new Label("click this button");
final Button btnTest = new Button("test me");
btnTest.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
lb.setVisible(!lb.isVisible());
}
});
RootPanel.get().add(lb);
RootPanel.get().add(btnTest);
}
}
main.gwt.xml如下所示:
<module>
<inherits name="com.google.gwt.user.User"/>
<inherits name="com.extjs.gxt.ui.GXT"/>
<entry-point class="com.mycompany.mainproject.adminwebapp.frontend.MainEntryPoint"/>
<inherits name="com.google.gwt.user.theme.standard.Standard"/>
</module>
web.xml是这样的:
<welcome-file-list>
<welcome-file>index.html</welcome-file> <!--index file only have doctype and body-->
</welcome-file-list>
不,我已经碰到了这个gwt-maven plugin example我认为我迷失了。 那么这个错误的原因究竟是什么呢?一个类路径问题或maven-plugin问题,或者我甚至需要更多配置?
感谢您阅读这篇相当长篇文章,但这是为了精确。如果您认为最好切换到eclipse(STS),请让我有您的见解。
答案 0 :(得分:0)
我遇到同样的麻烦: