2016-08-22 148 views
0

我正在開發一個maven項目,它是多模塊項目,我希望將文件從moduleA/src/main/bin/abc.sh包含到其他模塊說模塊B已經有它的結構像moduleB/src/main/bin/pqr.sh 在建設項目上模塊的結構就像moduleB/bin /..*。sh 如何在abc.sh中包含ab moduleB 我已經使用maven-資源 - 插件嘗試作爲如何將文件從一個模塊包含到多模塊maven項目中的另一個模塊

<plugin> 
      <artifactId>maven-resources-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>copy-cleanup</id> 
        <phase>generate-resources</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>/bin</outputDirectory> 
         <overwrite>true</overwrite> 
         <resources> 
          <resource> 
           <directory>${multi.module.project.root.dir}/modules/abc/src/main/bin</directory> 
           <includes> 
            <include>abc.sh</include> 
           </includes> 
          </resource> 
         </resources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

它給我的錯誤建設項目爲

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.1:copy-resources (copy-cleanup) on project moduleB: /bin/abc.sh (Permission denied) -> [Help 1] 
+0

看來,誰啓動腳本的用戶沒有足夠的權限。如果在項目的根目錄下運行sudo chmod 777 -R,會怎麼樣? – kosbr

+0

將文件複製到'/ bin /'當然沒有權限,這根本沒有意義。而且你也不應該在Maven構建過程中這樣做...... – khmarbaise

回答

0

如果你真的在你的機器的/bin目錄下工作,你應該知道要在UNIX上的這個目錄下工作,你需要root賬號。

此外,我建議不要在您的機器上使用ROOT帳戶

我建議您改用read來訪問您當前用來打包應用程序的用戶。

命令:

sudo chmod o+r /bin/abc.sh 
相關問題