3

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 モジュールとして別のプロジェクトに追加しようとしています。このアドオンの 1 つのクラス (VGanttTreeTable) は、前に説明した方法で vaadin jar (VTreeTable) からクラスを拡張します。

4

0 に答える 0