0

Maven プロジェクトで、コード カバレッジ用のプラグインを追加し、pom.xml でバグを見つけようとしています。エラー トレースを貼り付けました。プラグインを削除すると、正常に動作します。助言がありますか?

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.clusters.demo</groupId>
  <artifactId>webservice-demo</artifactId>
  <version>1</version>
  <packaging>war</packaging>

  <name>demo</name>
  <url>http://maven.apache.org</url>

  <build>
  <plugins>
      <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>2.4.0</version>
          <configuration>
              <effort>Max</effort>
              <failOnError>true</failOnError>
              <threshold>High</threshold>
              <xmlOutput>true</xmlOutput>
          </configuration>
          <executions>
              <execution>
                  <id>findbugs-report</id>
                  <phase>package</phase>
                  <goals>
                      <goal>findbugs</goal>
                  </goals>
              </execution>
          </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>  
                <formats>
                    <format>html</format>
                    <format>xml</format>  
                </formats>  
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>cobertura</goal>  
                    </goals>  
                </execution>  
            </executions>  
        </plugin>
  </plugins>
</build>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>maven-central</id>
            <url>some url</url>
        </repository>
        <repository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <id>maven-snapshots</id>
            <url>some url</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.0.1.Final</version>
            <!--scope>provided</scope -->
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-hibernate3</artifactId>
            <version>2.0.8</version>
        </dependency>

        <!--dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>3.1.1.RELEASE</version>
        </dependency-->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-asm</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-oxm</artifactId>
         <version>3.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.8</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.5.8</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.1.0</version>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.1</version>
        </dependency>

        <dependency>
          <groupId>commons-lang</groupId>
          <artifactId>commons-lang</artifactId>
          <version>2.4</version>
        </dependency>

        <dependency>
          <groupId>org.freemarker</groupId>
          <artifactId>freemarker</artifactId>
          <version>2.3.19</version>
        </dependency>
    </dependencies>
</project>

エラー -

[ERROR] Failed to execute goal on project demo-webservice: Could not re
solve dependencies for project com.clusters.demo:demo-webservice:war:1: Cou
ld not find artifact org.springframework:spring-aop:jar:3.0.0.RC3 in maven-centr
al ( some url ) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
4

3 に答える 3

0

これを試して

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-aop</artifactId>
  <version>3.0.0.RC3</version>
</dependency>

ではごきげんよう

于 2013-01-24T10:53:22.647 に答える
0

春の依存関係の 1 つに spring-aop:3.0.0.RC3 が必要だと思います。2 つの可能性があります。1. どこを見つけて除外するかを試してください。2. org.springframework spring-aop 3.0.0.RC3

アーティファクト org.springframework:spring-aop:jar:3.0.0.RC3 in maven-central (いくつかの url ) Maven は、リポジトリで探している依存関係を見つけることができませんでした。独自のリポジトリ サーバーがある場合は、そこにダウンロード/アップロードしてみてください

于 2013-01-24T10:53:26.420 に答える
0

findbugs と cobertura プラグインがパッケージ フェーズ内で実行できることを知りませんでした。これらは、通常、サイトの作成時に実行されるレポート プラグインです。プロジェクトのビルドとサイトのライフサイクルは異なります: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

両方のレポート (findbugs と cobertura) にはかなりの時間がかかるため、パッケージ段階では実行しません。

通常、それらをレポート プラグインとして設定し、以下を使用して実行します:mvn site http://mojo.codehaus.org/findbugs-maven-plugin/usage.html を参照てください 。 mojo.codehaus.org/cobertura-maven-plugin/usage.html

ただし、フェーズは構成されていません。それが悪さをする原因になることがあります。

表示されるエラー:Could not find artifact org.springframework:spring-aop:jar:3.0.0.RC3上記の pom の依存関係のバージョンが異なるため、少し奇妙です。また、pom とエラー メッセージで artifactId が異なります (demo-webservice と webservice-demo)。これらのプロジェクトは関連していますか? を実行mvn dependency:treeして、aop 3.0.0.RC3 バージョンがどこから来たのかを突き止めます。

バージョンを 1-SNAPSHOT に変更してください。そうしないと、Maven はそれがリリースされたバージョン (-SNAPSHOT サフィックスなし) であると見なします。

これが少し役立ったことを願っています:)

于 2013-01-24T10:56:17.270 に答える