Maven没有检测到现有文件

时间:2013-11-27 21:45:55

标签: maven

我正在编写一个pom文件来有条件地检出或更新git中的子目录。但是,它总是做一个干净的结帐。我这样做是为了围绕现有项目包装CI脚本而不必更改它们。

这是代码(略有删失,并且省略了更新):

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>standard-php-project</artifactId>
  <version>1.0</version>
    <properties>
      <git.project>Test/Project</git.project>
      <git.project.checkout.directory>${basedir}/src/php/main/${git.project}</git.project.checkout.directory>
      <git.project.checkout.exists.file>${git.project.checkout.directory}/.git/index</git.project.checkout.exists.file>
    </properties>
    <scm>
      <connection>scm:git:ssh://server/git/${git.project}</connection>
    </scm>
    <profiles>
      <profile>
        <id>scm-checkout</id>
        <activation>
          <file>
            <missing>${git.project.checkout.exists.file}</missing>
          </file>
        </activation>
        <build>
          <plugins>
            <plugin>
              <groupId>com.soebes.maven.plugins</groupId>
              <artifactId>maven-echo-plugin</artifactId>
              <version>0.1</version>
              <executions>
                <execution>
                <id>echo-missing-file</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>echo</goal>
                </goals>
                <configuration>
                  <echos>
                    <echo>Couldn't find ${git.project.checkout.exists.file}</echo>
                  </echos>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.8.1</version>
            <executions>
              <execution>
                <id>scm-generate-sources-phase</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>checkout</goal>
                </goals>
                <configuration>
                  <checkoutDirectory>${git.project.checkout.directory}</checkoutDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- And another profile for when the file exists, not shown for brevity -->
  </profiles>
</project>

我运行mvn compile告诉我它测试的文件,对文件执行ls -l以验证它是否存在,然后再次运行。由于某种原因,测试失败。

帮助!

0 个答案:

没有答案