Maven 循环依赖?

发布于 2024-08-06 00:34:32 字数 16798 浏览 7 评论 0原文

如果我将其添加到 POM 中,它会创建循环依赖吗?我已经尝试过,似乎会发生什么。这里有一些我不明白的事情。不是在构建结束时创建的war文件吗?

 <dependency>
  <groupId>${project.groupId}</groupId>
  <artifactId>mywebapp</artifactId>
  <version>${project.version}</version>
  <type>war</type>
  <scope>provided</scope>
 </dependency>

我的目录结构是root/functest,root/mywebapp。

有效聚甲醛

    [INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] org.grails: checking for updates from tapestry.javaforge
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - IGNORING
[INFO] org.apache.maven.plugins: checking for updates from tapestry.javaforge
[INFO] org.codehaus.mojo: checking for updates from tapestry.javaforge
[INFO] artifact org.apache.maven.plugins:maven-help-plugin: checking for updates from tapestry.javaforge
[INFO] ------------------------------------------------------------------------
[INFO] Building functional-tests
[INFO]    task-segment: [help:effective-pom] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:effective-pom]
[INFO] 
Effective POMs, after inheritance, interpolation, and profiles are applied:

<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 9/30/09 10:41 AM                     -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Effective POM for project 'com.mycompany:functest:pom:1.0-SNAPSHOT'    -->
<!--                                                                        -->
<!-- ====================================================================== -->

<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>
    <artifactId>myapp</artifactId>
    <groupId>com.mycompany</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <groupId>com.mycompany</groupId>
  <artifactId>functest</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>functional-tests</name>
  <url>http://www.mycompany.com/functest</url>
  <organization>
    <name>My Company Inc</name>
    <url>http://www.mycompany.com</url>
  </organization>
  <developers>
    <developer>
      <id>john.doe</id>
      <name>John Doe</name>
      <email>[email protected]</email>
    </developer>
  </developers>
  <build>
    <sourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\it</testSourceDirectory>
    <outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\classes</outputDirectory>
    <testOutputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <mergeId>resource-0</mergeId>
        <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <mergeId>resource-1</mergeId>
        <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target</directory>
    <finalName>functest-1.0-SNAPSHOT</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-2</version>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-ear-plugin</artifactId>
          <version>2.3.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-ejb-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>2.4.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-rar-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.0-beta-8</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>2.0-beta-7</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.0.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.4.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.1-alpha-2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/it/testng.xml</suiteXmlFile>
          </suiteXmlFiles>
          <parallel>true</parallel>
          <threadCount>10</threadCount>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0.1-alpha-1</version>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <deployer>
                <deployables>
                  <deployable>
                    <groupId>com.mycompany</groupId>
                    <artifactId>mywebapp</artifactId>
                    <type>war</type>
                    <pingURL>http://localhost:8080/mywebapp/index.html</pingURL>
                    <pingTimeout>300000</pingTimeout>
                    <properties>
                      <context>mywebapp</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <wait>false</wait>
          <container>
            <containerId>tomcat5x</containerId>
            <zipUrlInstaller>
              <url>http://www.apache.org/dist/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28.zip</url>
              <installDir>${installDir}</installDir>
            </zipUrlInstaller>
            <output>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x.log</output>
            <log>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/cargo.log</log>
          </container>
          <configuration>
            <home>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x/container</home>
            <properties>
              <cargo.logging>high</cargo.logging>
              <cargo.servlet.port>8080</cargo.servlet.port>
            </properties>
          </configuration>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-help-plugin</artifactId>
        <version>2.1</version>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
    </repository>
    <repository>
      <releases />
      <snapshots />
      <id>openqa-releases</id>
      <url>http://nexus.openqa.org/content/repositories/releases</url>
    </repository>
    <repository>
      <id>openqa</id>
      <url>http://maven.openqa.org</url>
    </repository>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <url>http://repo1.maven.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <snapshots />
      <id>openqa-plugin</id>
      <url>http://nexus.openqa.org/content/repositories/releases</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <snapshots />
      <id>another-plugin</id>
      <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <id>codehaus.snapshots</id>
      <url>http://snapshots.repository.codehaus.org/</url>
    </pluginRepository>
    <pluginRepository>
      <id>mortbay.repo</id>
      <url>http://www.mortbay.org/maven2/snapshot</url>
    </pluginRepository>
    <pluginRepository>
      <id>tapestry.javaforge</id>
      <url>http://howardlewisship.com/repository</url>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Plugin Repository</name>
      <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <dependencies>
    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>mywebapp</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium.server</groupId>
      <artifactId>selenium-server</artifactId>
      <version>1.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
      <artifactId>selenium-java-client-driver</artifactId>
      <version>1.0.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.1</version>
      <classifier>jdk15</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <reporting>
    <outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/site</outputDirectory>
  </reporting>
</project>

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Sep 30 10:41:00 CEST 2009
[INFO] Final Memory: 7M/13M
[INFO] ------------------------------------------------------------------------

If I add this to a POM will it create a circular dependency? I've tried it and that what seems to happen. There is something I'm not understanding here. Isn't the war file created at the end of the build.

 <dependency>
  <groupId>${project.groupId}</groupId>
  <artifactId>mywebapp</artifactId>
  <version>${project.version}</version>
  <type>war</type>
  <scope>provided</scope>
 </dependency>

My directory structure is root/functest, root/mywebapp.

Effective POM

    [INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] org.grails: checking for updates from tapestry.javaforge
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'ee0f52bc37051384f078f9706be9445b550ee4a6'; remote = 'a535436f42caf1ba0f9372328d2920372f30c842' - IGNORING
[INFO] org.apache.maven.plugins: checking for updates from tapestry.javaforge
[INFO] org.codehaus.mojo: checking for updates from tapestry.javaforge
[INFO] artifact org.apache.maven.plugins:maven-help-plugin: checking for updates from tapestry.javaforge
[INFO] ------------------------------------------------------------------------
[INFO] Building functional-tests
[INFO]    task-segment: [help:effective-pom] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:effective-pom]
[INFO] 
Effective POMs, after inheritance, interpolation, and profiles are applied:

<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Generated by Maven Help Plugin on 9/30/09 10:41 AM                     -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/                -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- ====================================================================== -->
<!--                                                                        -->
<!-- Effective POM for project 'com.mycompany:functest:pom:1.0-SNAPSHOT'    -->
<!--                                                                        -->
<!-- ====================================================================== -->

<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>
    <artifactId>myapp</artifactId>
    <groupId>com.mycompany</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <groupId>com.mycompany</groupId>
  <artifactId>functest</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>functional-tests</name>
  <url>http://www.mycompany.com/functest</url>
  <organization>
    <name>My Company Inc</name>
    <url>http://www.mycompany.com</url>
  </organization>
  <developers>
    <developer>
      <id>john.doe</id>
      <name>John Doe</name>
      <email>[email protected]</email>
    </developer>
  </developers>
  <build>
    <sourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\it</testSourceDirectory>
    <outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\classes</outputDirectory>
    <testOutputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <mergeId>resource-0</mergeId>
        <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <mergeId>resource-1</mergeId>
        <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target</directory>
    <finalName>functest-1.0-SNAPSHOT</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-2</version>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-ear-plugin</artifactId>
          <version>2.3.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-ejb-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>2.4.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-rar-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.0-beta-8</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>2.0-beta-7</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.0.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.4.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.1-alpha-2</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.3</version>
        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/it/testng.xml</suiteXmlFile>
          </suiteXmlFiles>
          <parallel>true</parallel>
          <threadCount>10</threadCount>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0.1-alpha-1</version>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <deployer>
                <deployables>
                  <deployable>
                    <groupId>com.mycompany</groupId>
                    <artifactId>mywebapp</artifactId>
                    <type>war</type>
                    <pingURL>http://localhost:8080/mywebapp/index.html</pingURL>
                    <pingTimeout>300000</pingTimeout>
                    <properties>
                      <context>mywebapp</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <wait>false</wait>
          <container>
            <containerId>tomcat5x</containerId>
            <zipUrlInstaller>
              <url>http://www.apache.org/dist/tomcat/tomcat-5/v5.5.28/bin/apache-tomcat-5.5.28.zip</url>
              <installDir>${installDir}</installDir>
            </zipUrlInstaller>
            <output>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x.log</output>
            <log>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/cargo.log</log>
          </container>
          <configuration>
            <home>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/tomcat5x/container</home>
            <properties>
              <cargo.logging>high</cargo.logging>
              <cargo.servlet.port>8080</cargo.servlet.port>
            </properties>
          </configuration>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-help-plugin</artifactId>
        <version>2.1</version>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
    </repository>
    <repository>
      <releases />
      <snapshots />
      <id>openqa-releases</id>
      <url>http://nexus.openqa.org/content/repositories/releases</url>
    </repository>
    <repository>
      <id>openqa</id>
      <url>http://maven.openqa.org</url>
    </repository>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <url>http://repo1.maven.org/maven2</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <snapshots />
      <id>openqa-plugin</id>
      <url>http://nexus.openqa.org/content/repositories/releases</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <snapshots />
      <id>another-plugin</id>
      <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
    <pluginRepository>
      <releases />
      <id>codehaus.snapshots</id>
      <url>http://snapshots.repository.codehaus.org/</url>
    </pluginRepository>
    <pluginRepository>
      <id>mortbay.repo</id>
      <url>http://www.mortbay.org/maven2/snapshot</url>
    </pluginRepository>
    <pluginRepository>
      <id>tapestry.javaforge</id>
      <url>http://howardlewisship.com/repository</url>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Plugin Repository</name>
      <url>http://repo1.maven.org/maven2</url>
    </pluginRepository>
  </pluginRepositories>
  <dependencies>
    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>mywebapp</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium.server</groupId>
      <artifactId>selenium-server</artifactId>
      <version>1.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium.client-drivers</groupId>
      <artifactId>selenium-java-client-driver</artifactId>
      <version>1.0.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.1</version>
      <classifier>jdk15</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <reporting>
    <outputDirectory>C:\Documents and Settings\ric\AutoSmokeTest\steps\step7\functest\target/site</outputDirectory>
  </reporting>
</project>

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Sep 30 10:41:00 CEST 2009
[INFO] Final Memory: 7M/13M
[INFO] ------------------------------------------------------------------------

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

妥活 2024-08-13 00:34:32

仅当 mywebapp 依赖于 functest (或传递依赖于它)时,它才会创建循环依赖。从名称来看,我猜测 functest 是一个测试组件,因此不存在这样的依赖关系。

正如您所看到的,将属性替换为依赖项声明是有效的,如果确实导致循环,Maven 将使构建失败。

我猜您对“war 文件不是在构建结束时创建的”感到困惑。是因为您预计构建会失败,因为 functest 是在 mywebapp 之前构建的?请记住,Maven 可以访问本地和远程存储库,因此 mywebapp 的任何先前构建的结果都将在存储库中可用。如果是这种情况,请尝试从本地/远程存储库中删除 mywebapp ,我怀疑您会因为未解决的依赖关系而看到构建失败。

It will only create a cyclic dependency if mywebapp is dependent on functest (or transitively dependent on it). From the name I would guess that functest is a test component so no such dependency would exist.

As you've seen, it is valid to substitute properties into dependency declarations, Maven will fail the build if it does result in a cycle.

I guess your confusion around "Isn't the war file created at the end of the build." is because you expect the build to fail as functest is built before mywebapp? Remember that Maven has access to local and remote repositories, so the result of any previous build of mywebapp will be available in the repository. If this is the case, try deleting mywebapp from you local/remote repositories and I suspect you will see the build fail due to an unresolved dependency.

云巢 2024-08-13 00:34:32

如果我将其添加到 POM 中,它会创建循环依赖吗?

如果您引用的 pom 是 functest 模块的 pom,则仅当 mywebapp 模块添加依赖项时,才会创建循环依赖项正如 Rich 在另一个答案中所述,code> 模块已经依赖于 functest 模块(这里不应该是这种情况)。

我已经尝试过,似乎会发生什么。

你确定吗?您的多模块项目定义明确吗?你能给我们看一下父 pom 吗?你能提供从父级启动maven时获得的跟踪吗?

[...]war 文件不是在构建结束时创建的吗?

嗯...这取决于你在做什么。

如果您严格遵循 使用 Selenium、Cargo、TestNG 和 Maven 进行自动冒烟测试,请注意,作者并没有真正涵盖多模块项目设置(我并不是说他没有这样做,我只是说他在不涵盖该部分),但仅涵盖功能测试项目设置。他总是从 functest 目录启动 maven,从不作为父 pom 中的 Reactor,并且在第 7 步中由 Cargo 部署的 webapp 被视为“外部”依赖项。

现在,如果您正在开发自己的 Web 应用程序,那么在运行功能测试之前构建它确实很有意义。实际上,这将是“推荐”的方法。在您的情况下,请务必将 mywebapp 声明为 functest 的依赖项,并将两个项目声明为父 pom 的模块,即类似的内容(如果父 pom 是在父目录中):

  ...
  <modules>
    <module>mywebapp</module>
    <module>functest</module>
  </modules>
  ...

If I add this to a POM will it create a circular dependency?

If the pom you are referring to is the pom of the functest module, adding a dependency to the mywebapp module will create a circular dependency only if the mywebapp module already depends on the functest module (which should not be the case here) as stated by Rich in another answer.

I've tried it and that what seems to happen.

Are you sure? Is your multi-modules project well defined? Can you show us the parent pom? Can you provide the trace obtained when launching maven from the parent?

[...] Isn't the war file created at the end of the build?

Well... it depends on what you are doing.

If you are strictly following Automated Smoke Tests With Selenium, Cargo, TestNG and Maven, please note that the author is not really covering the multi-modules project setup (I'm not saying he's not doing it, I'm just saying he's not covering that part) but only the functional testing project setup. He always launch maven from the functest directory, never as a reactor from the parent pom, and the webapp deployed by cargo in the step 7 is treated like an "external" dependency.

Now, if you are developing your own webapp, building it prior to run functional tests on it really makes sense. Actually, this would be the "recommended" approach. In your case, be sure to declare mywebapp as a dependency of functest and to declare both projects as modules of the parent pom, i.e. something like that (if the parent pom is in a parent directory):

  ...
  <modules>
    <module>mywebapp</module>
    <module>functest</module>
  </modules>
  ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文