2012-03-05 20 views
5

Tôi có một ứng dụng web dựa trên một số mô-đun. Vì vậy, để xây dựng nó, tôi có một tập tin pom.xml chủ. Những gì tôi muốn tập tin pom để làm là để kiểm tra tất cả các mô-đun. dưới đây là tệp pom của tôi.Cách sử dụng tệp pom chính để kiểm tra tất cả các mô-đun của ứng dụng web và xây dựng tất cả các mô-đun

 <executions> 
     <execution> 
        <id>check-out-project1</id> 
        <phase>generate-sources</phase> 
        <goals> 
        <goal>checkout</goal> 
        </goals> 
        <configuration>  
        <checkoutDirectory>${project.build.directory}/module1</checkoutDirectory> 
        <connectionUrl>scm:svn:svn://svnserver/svn/module1/trunk</connectionUrl> 
        <!--<developerConnection>scm:svn:svn://svnserver/svn/module1/trunk</developerConnection>!--> 
        <username>username</username>        
        <password>password</password>    
        </configuration> 
     </execution> 

      <execution> 
        <id>check-out-project2</id> 
        <phase>generate-sources</phase> 
        <goals> 
        <goal>checkout</goal> 
        </goals> 
        <configuration>  
        <checkoutDirectory>${project.build.directory}/module1</checkoutDirectory> 
        <connectionUrl>scm:svn:svn://svnserver/svn/module1/trunk</connectionUrl> 
          <username>username</username>        
          <password>password</password>    
        </configuration> 
      </execution> 
     </executions> 

Tôi đã thử mvn scm: checkoutmvn scm: thanh toán -Kiểm tra-out-project1 nhưng nó cung cấp cho tôi những lỗi: Không thể chạy lệnh thanh toán: Có thể không tải nhà cung cấp scm . Bạn cần xác định tham số connectionUrl.

Tôi không hiểu tại sao điều này xảy ra vì tôi có thông số connectionUrl được xác định bên trong tệp pom, điểm ý tưởng mà tôi muốn có là tệp pom được định cấu hình để có thể thanh toán nhiều dự án tại cùng lúc. Xin vui lòng cho tôi biết những gì tôi đang làm sai ở đây, Cảm ơn trước.

+0

Bạn có kho lưu trữ maven để xuất bản các tạo tác của mình không? Tôi nghĩ rằng bạn nên cố gắng để có các module phụ thuộc trước khi xây dựng (và thử nghiệm) trước khi sử dụng chúng trong lắp ráp chính của bạn. Ngay cả khi bạn chỉ sử dụng repo ~/.m2 cục bộ của bạn. Điều này sẽ cho phép bạn sử dụng maven-dependency-plugin và tải xuống các tạo phẩm được biên dịch và kiểm tra trực tiếp (giả sử bạn có các thử nghiệm). – hovanessyan

Trả lời

2

tôi phải đối mặt với cùng tình hình và tôi tìm thấy một giải pháp • nhập mã của bạn: D- hoạt động trên máy tính của tôi:

<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>de.xxx.internet</groupId> 
    <artifactId>my-app</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Maven Quick Start Archetype</name> 
    <url>http://www.mySite.de</url> 
    <scm> 
     <connection>scm:svn:http://svn-repo-adress:8080/repo/myDirectory</connection> 
     <developerConnection>http://svn-repo-adress:8080/repo/myDirectory</developerConnection> 
     <tag>HEAD</tag> 
     <url>http://svn-repo-adress:8080/repo/myDirectory</url> 
    </scm> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    </properties> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-scm-plugin</artifactId> 
       <version>1.6</version> 
       <configuration> 
       <goals>checkout</goals> 
       <checkoutDirectory>target/checkout</checkoutDirectory> 
       <username>username</username> 
       <password>userpassword</password> 
       </configuration> 
       <executions> 
       <execution> 
        <id>check-out-project1</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>checkout</goal> 
        </goals> 
       </execution> 
      </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

Sau khi tôi thực hiện "mvn scm: thanh toán" trên console cmd nó đã làm việc .

Tôi nghĩ điểm quan trọng là thêm thẻ scm trước, trước khi tôi thực thi thẻ xây dựng.

2

Tôi nhận thấy rằng nếu đặt từng séc vào <execution> ... </execution> riêng của mình và thay thế cho từng cá nhân <configuration> ... </configuration> để chúng hoạt động. Ví dụ:

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-scm-plugin</artifactId> 
      <version>1.9.4</version> 
      <executions> 
       <execution> 
        <id>repo1-dependency</id> 
        <phase>generate-sources</phase> 
        <configuration> 
         <connectionUrl>${my.repo1.url}</connectionUrl> 
         <scmVersion>${my.repo1.branch}</scmVersion> 
         <scmVersionType>branch</scmVersionType> 
         <checkoutDirectory>${project.build.directory}/${my.repo1}-${my.repo1.branch}</checkoutDirectory> 
        </configuration> 
        <goals> 
         <goal>checkout</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>repo2-dependency</id> 
        <phase>generate-sources</phase> 
        <configuration> 
         <connectionUrl>${my.repo2.url}</connectionUrl> 
         <scmVersion>${my.repo2.branch}</scmVersion> 
         <scmVersionType>branch</scmVersionType> 
         <checkoutDirectory>${project.build.directory}/${my.repo2}-${my.repo2.branch}</checkoutDirectory> 
        </configuration> 
        <goals> 
         <goal>checkout</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
+0

Bạn có thể đăng tệp pom hoàn chỉnh của mình như tôi đã thử và tôi chỉ nhận được 1 lần thực thi và nó sử dụng thông tin thẻ scm chứ không phải connectionUrl từ cấu hình. – mario

Các vấn đề liên quan