2011-01-18 26 views
14

Câu hỏi tương tự: Can Ant's tar task set a Linux file permission even when the task is used on other platforms?Sử dụng plugin lắp ráp Maven để đặt quyền tệp Linux ngay cả khi chạy trên các nền tảng khác?

Nếu tôi sử dụng plugin lắp ráp Maven 2 với bộ mô tả 'dự án', có cách nào để đặt quyền vỏ tập lệnh để thực thi ví dụ cho tệp build.sh được bao gồm không?

Ví dụ:

 <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <descriptorRefs> 
        <descriptorRef>project</descriptorRef> 
       </descriptorRefs> 
      </configuration> 
     </plugin> 

này sẽ tạo ra ba file

  • -project.tar.bz2
  • -project.tar.gz
  • -project-zip

Và tôi muốn đặt quyền đối với tệp r tất cả các tệp * .sh nằm trong tệp tar để 'thực thi'.

Trả lời

35

Điều này có thể được thực hiện bằng tham số fileMode có sẵn trong Plugin lắp ráp Maven assembly descriptor. Ví dụ:

<assembly> 
    ... 
    <fileSets> 
     <fileSet> 
      <directory>${project.build.directory}/bin</directory> 
      <outputDirectory>/bin</outputDirectory> 
      <includes> 
       <include>*.sh</include> 
      </includes> 
      <fileMode>0755</fileMode> 
     </fileSet> 
     ... 
    </fileSets> 
    ... 
</assembly> 
+0

tuyệt vời, cảm ơn! (dễ dàng hơn nhiều so với công việc này với Ant) – mjn

+0

Làm thế nào để nó hoạt động nếu tôi biên dịch plugin của tôi Eclipse RCp với Tycho? Tôi cần phải viết những tập tin này ở đâu? Tôi chỉ có một số tập tin pomx.xml ... Có một "fileMode" với Tycho? – user376112

+0

Phù hợp với dòng cuối cũng là –

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