1

我已经成功地从带有 maven 的 wsdl 正确地创建了一个 jar 客户端,但现在我想在我的主项目中使用它。我正确地添加了依赖项(jar 在生成的战争中是正确的,它也在我的 m2 存储库中),但似乎 eclipse 没有识别它的组件。

这些部分是各自的 pom:“WSDL 客户端生成器”

<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>

  <parent>
    <groupId>es.tenentia.copal</groupId>
    <artifactId>parent</artifactId>
    <version>0.1-SNAPSHOT</version>
  </parent>

  **<groupId>es.tenentia.copal</groupId>
  <artifactId>copalWSClient</artifactId>
  <version>1.0-SNAPSHOT</version>**

  <packaging>jar</packaging>
  <name>CopalTool wsdl processor</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>axistools-maven-plugin</artifactId>
                <version>1.4</version>
                <dependencies>
                    <dependency>
                      <groupId>javax.mail</groupId>
                      <artifactId>mail</artifactId>
                      <version>1.4.1</version>
                    </dependency>
                    <dependency>
                      <groupId>javax.activation</groupId>
                      <artifactId>activation</artifactId>
                      <version>1.1</version>
                    </dependency>
                </dependencies>
                <configuration>
                  <!-- The plugin navigates your source src/main/** tree and finds your WSDLs for you;
                  just name them individually in a <wsdlFiles/> element. -->
                  <sourceDirectory>src/main/resources</sourceDirectory>
                  <wsdlFiles>
                    <wsdlFiles>ToolService.wsdl</wsdlFiles>
                  </wsdlFiles>


                  <!-- This is optional, but lets you explicitly namespace the generated code. -->
                  <!--
                  <packageSpace>com.axis.generated</packageSpace>
                  <testCases>true</testCases>
                  -->

                  <serverSide>true</serverSide>
                  <subPackageByFileName>true</subPackageByFileName>
                </configuration>

            <executions>
              <execution>
              <phase>generate-sources</phase>
                <goals>
                  <goal>wsdl2java</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
    </build>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
  <!-- *** AXIS DEPENDECES -->
    <dependency>
      <groupId>org.apache.axis</groupId>
      <artifactId>axis</artifactId>
      <version>1.4</version>
    </dependency>
    <dependency>
      <groupId>javax.xml</groupId>
      <artifactId>jaxrpc-api</artifactId>
      <version>1.1</version>
    </dependency>

    <!-- END AXIS -->

  </dependencies>
</project>

“战争发电机”

<?xml version="1.0" encoding="ISO-8859-15"?>
<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>

      <parent>
        <groupId>es.tenentia.copal</groupId>
        <artifactId>parent</artifactId>
        <version>0.1-SNAPSHOT</version>
      </parent>
    <groupId>es.tenentia.copal</groupId>
    <artifactId>copal</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>CopalTool War Processor</name>

    <properties>
        <struts2.version>2.3.14</struts2.version>
        <spring.version>3.0.7.RELEASE</spring.version>
        <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <!-- Struts 2  -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-config-browser-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-junit-plugin</artifactId>
            <version>${struts2.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>1.3.10</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>sitemesh</artifactId>
            <version>2.4.2</version>
        </dependency>

        <!-- Spring Dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring.version}</version>
        </dependency>  

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>

        <!-- WebService dependency -->
        **<dependency>
          <groupId>es.tenentia.copal</groupId>
          <artifactId>copalWSClient</artifactId>
          <version>1.0-SNAPSHOT</version>
        </dependency>**


    <!-- Hibernate and database access -->
        <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc14</artifactId>
          <version>10.2.0.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.6.3.Final</version>
        </dependency>

    </dependencies>

    <build>
    <finalName>copaltool</finalName>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.7.v20120910</version>
                <configuration>
                    <stopKey>CTRL+C</stopKey>
                    <stopPort>8999</stopPort>
                    <systemProperties>
                        <systemProperty>
                            <name>log4j.configuration</name>
                            <value>file:${basedir}/src/main/resources/log4j.properties</value>
                        </systemProperty>
                        <systemProperty>
                            <name>slf4j</name>
                            <value>false</value>
                        </systemProperty>
                    </systemProperties>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
                    <webAppConfig>
                        <contextPath>/struts2-blank</contextPath>
                        <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
                    </webAppConfig>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.17</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

有人知道会发生什么吗?

谢谢你们!

4

1 回答 1

1

根据您所写的内容,我的第一个想法是检查您想要的所有 jars/classes 是否在 eclipse 的构建路径中?

如果没有,您可能需要使用 mvn eclipse:eclipse 生成 .classpath 文件,然后使用它。这是假设您有一个 M2_REPO 变量集并指向您的本地仓库。您可以检查生成的 .classpath 文件以确保所有所需的 jars/classes 都存在。

您还可以打开项目属性并将本地 repo 中的 jar 添加为外部 jar,或者将您的第一个项目添加为第二个项目的“构建路径上的必需项目”。后者在您开发时可能更方便。

于 2013-08-21T01:40:18.673 回答