我正在尝试从jar文件扩展类(它存在于我的Maven依赖项中),我需要访问它的内部类。为了解决这个问题,我在我的项目中将包命名为超类包。 Eclipse似乎没有问题,但maven编译器只是看不到那些内部类。我可以做些什么吗?
pom.xml:
<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>com.company.app</groupId>
<artifactId>app-gantt</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>AppGantt</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>6.8.3</vaadin.version>
<gwt.version>2.3.0</gwt.version>
<gwt.plugin.version>2.2.0</gwt.plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
<!-- Implementation-Title and Implementation-Version come from the POM by default -->
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<!-- Package format version - do not change -->
<Vaadin-Package-Version>1</Vaadin-Package-Version>
<!-- Add-on specific fields to update -->
<!-- Implementation-Title and Implementation-Version come from the POM by default -->
<!--
<Implementation-Title>${pom.name}</Implementation-Title>
<Implementation-Version>${pom.version}</Implementation-Version>
-->
<!-- Comma-separated list of widgetsets in the package -->
<Vaadin-Widgetsets>com.company.app.gantt.gwt.AppGanttWidgetset</Vaadin-Widgetsets>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- Compiles your custom GWT components with the GWT compiler -->
<!-- A hosted mode browser for client-side widget debugging can be run with the goal gwt:run after uncommenting the
correct line below. A remote debugger can then be connected to port 8998. Note that e.g. a Jetty server should be running
with the server side parts - use the goal jetty:run . -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.plugin.version}</version>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<modules>
<module>com.company.app.gantt.gwt.AppGanttWidgetset</module>
</modules>
<webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets</webappDirectory>
<!-- On Mac running Snow Leopard, add "-d32" -->
<!-- This causes error messages (but build works) in phase "package": two processes would use the same debug
port -->
<!--extraJvmArgs>-Xmx512M -Xss1024k -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8998</extraJvmArgs -->
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<runTarget>app-gantt</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
<noServer>true</noServer>
<port>8080</port>
<compileReport>false</compileReport>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<configuration>
<modules>
<module>com.company.app.gantt.gwt.AppGanttWidgetset</module>
</modules>
</configuration>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- A simple Jetty test server at http://localhost:8080/app-gantt can be launched with the Maven goal jetty:run
and stopped with jetty:stop -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.24</version>
<configuration>
<stopPort>9966</stopPort>
<stopKey>app-gantt</stopKey>
<!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment -->
<scanIntervalSeconds>0</scanIntervalSeconds>
<!-- make sure Jetty also finds the widgetset -->
<webAppConfig>
<contextPath>/app-gantt</contextPath>
<baseResource implementation="org.mortbay.resource.ResourceCollection">
<!-- Workaround for Maven/Jetty issue http://jira.codehaus.org/browse/JETTY-680 -->
<!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
<resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
</baseResource>
</webAppConfig>
</configuration>
</plugin>
</plugins>
<!-- This is needed for the sources required by the GWT compiler to be included in the produced JARs -->
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
...
</pluginManagement>
</build>
<repositories>
...
</repositories>
<pluginRepositories>
...
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>contextmenu</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>ru.bazon</groupId>
<artifactId>pstring</artifactId>
<version>0.0.1.0</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>gwt-graphics</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project app-gantt: Compilation failure: Compilation failure:
[ERROR] /D:/App/workspace/folder ze spacjami/app/app-widget-gantt/app-gantt/src/main/java/com/vaadin/terminal/gwt/client/ui/VGanttTreeTable.java:[103,56] cannot find symbol
[ERROR] symbol: class VTreeTableScrollBody
[ERROR] location: class com.vaadin.terminal.gwt.client.ui.VGanttTreeTable
[ERROR] /D:/App/workspace/folder ze spacjami/app/app-widget-gantt/app-gantt/src/main/java/com/vaadin/terminal/gwt/client/ui/VGanttTreeTable.java:[100,24] incompatible types
[ERROR] required: com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody
[ERROR] found: com.vaadin.terminal.gwt.client.ui.VGanttTreeTable.VGanttTreeTableScrollBody
[ERROR] /D:/App/workspace/folder ze spacjami/app/app-widget-gantt/app-gantt/src/main/java/com/vaadin/terminal/gwt/client/ui/VGanttTreeTable.java:[111,17] method does not override or implement a method from a supertype
[ERROR] /D:/App/workspace/folder ze spacjami/app/app-widget-gantt/app-gantt/src/main/java/com/vaadin/terminal/gwt/client/ui/VGanttTreeTable.java:[244,47] bad operand types for binary operator '!='
[ERROR] first type: com.vaadin.terminal.gwt.client.ui.VGanttTreeTable.VGanttTreeTableScrollBody
[ERROR] second type: <nulltype>
....
我正在尝试编辑https://vaadin.com/directory#addon/vaadin-gantt-diagram并将另一个项目添加为maven模块。这个插件中的一个类(VGanttTreeTable)从vaadin jar(VTreeTable)扩展类,我之前描述过它。