2016-08-22 120 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