eclipse - Maven tomcat 插件不允许进入依赖的 jar

标签 eclipse debugging maven tomcat

我正在使用 Maven Tomcat 插件来测试使用 Hibernate 的 Maven 网络服务项目。

我的 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.honeywell.gt</groupId>
    <artifactId>WSOCCMeoReports</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Simple CXF project using spring configuration</name>
    <description>Simple CXF project using spring configuration</description>

    <properties>
        <shiro.version>1.2.1</shiro.version>
        <spring.version>3.1.2.RELEASE</spring.version>                      
        <cxf.version>2.6.1</cxf.version>                        
        <hibernate.version>3.6.5.Final</hibernate.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>    
       <!-- 
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
       <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>${hibernate.version}</version>
        </dependency> -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
        </dependency>                          

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
         <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>                   
        </dependency> 

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

        <dependency>
            <groupId>com.sybase.jdbc</groupId>
            <artifactId>SybDriver</artifactId>
            <version>3.0.0</version>
        </dependency>                                                       

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <!-- mvn clean install tomcat:run-war to deploy
                    Look for "Running war on http://xxx" and
                    "Setting the server's publish address to be /yyy"
                    in console output; WSDL browser address will be
                    concatenation of the two: http://xxx/yyy?wsdl
                    -->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>tomcat-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>start-tomcat</id>
                            <goals>
                                <goal>run-war</goal>
                            </goals>
                            <phase>pre-integration-test</phase>
                            <configuration>
                                <port>${test.server.port}</port>
                                <path>/webservice</path>
                                <fork>true</fork>
                                <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <configuration>
                        <projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
                        <wtpmanifest>true</wtpmanifest>
                        <wtpapplicationxml>true</wtpapplicationxml>
                        <wtpversion>2.0</wtpversion>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

调试目标是 tomcat:run-war

在服务中遇到断点后,我无法进入第三方依赖项,例如 Hibernate。但是,如果我从同一个 Maven Web 服务项目运行单元测试,我可以进入 Hibernate。

编辑 1:

我遇到了 this并获得了一些关于附加源的想法。事实上,我正在尝试调试 Hibernate,因此我编辑了源查找并在我的 .m2 存储库中添加了以下外部存档的路径:

hibernate-entitymanager-3.6.5.Final
hibernate-core-3.6.5.Final.

已保存更改,但 Eclipse 仍然找不到要进入的源代码。有人在吗?

最佳答案

问题似乎是 Maven Plugin for Eclipse 的已知问题,如 here 所示.

This post很有帮助,但我发现对于 hibernate 3.6.5,我必须将 hibernate-core-3.6.5.Final-sources.jar 添加到源查找路径而不是 hibernate-core-3.6.5.Final.jar。

关于eclipse - Maven tomcat 插件不允许进入依赖的 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14361311/

相关文章:

c++ - 使用 Libnoise 生成高度图

jquery - bootstrap selectpicker 和 bootstrap.js 文件之间存在冲突

c - DDD 运行时(?)错误

java - Maven WildFly 插件 : Could not execute goal deploy

java - 如何将 pom.xml 添加到现有的 Eclipse 项目?

Maven 类路径错误多个 SLF4J 绑定(bind)

Netbeans 上的 JavaScript 稀缺代码支持功能

Java 执行文件错误

java - 在 Eclipse 中获取同步源时查看 svn 提交消息/注释

python - Django - 唯一约束失败