2014-01-06 35 views
0

我想配置Bamboo CI服務器來構建項目。我正在使用maven資源插件來複制資源。在我的本地機器上構建成功,但是當我試圖通過Amazon EC2上的竹彈性代理構建它時,它會引發「權限被拒絕」錯誤。竹與彈性代理+ maven給予權限被拒絕錯誤

的pom.xml(刪除了依賴關係,因爲它是非常大名單)

 <project > 
    <modelVersion>4.0.0</modelVersion> 
    <groupId></groupId> 
    <artifactId>portalogue</artifactId> 
    <packaging>war</packaging> 
    <version></version> 
    <name></name> 
    <url></url> 


    <build> 
      <plugins> 
       <plugin> 
         <groupId>org.apache.tomcat.maven</groupId> 
         <artifactId>tomcat7-maven-plugin</artifactId> 
         <version>2.1</version> 
         <configuration> 
          <url></url> 
          <server>TomcatServer</server> 
          <path>/portalogue1</path> 
          <username>admin</username> 
          <password>admin</password> 
         </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.6</version> 
      <executions>  
       <execution> 
        <id>copy-hbm.xml-to-folder</id> 
        <phase>Build</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <outputDirectory>${user.home}/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate</outputDirectory> 
       <resources> 
        <resource> 
         <directory>${user.home}/myapp/portalogue/src/main/java/com/xti/portalogue/application/db/hibernate</directory> 
         <includes> 
          <include>**/*.hbm.xml</include> 
         </includes> 
        </resource> 
       </resources> 
      </configuration> 
     </plugin> 
    </plugins> 

     <finalName>portalogue1</finalName> 
</build> 

<reporting> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>findbugs-maven-plugin</artifactId> 
     <version>2.5.3</version> 
     <configuration> 
      <effort>Max</effort> 
      <threshold>Low</threshold> 
      <xmlOutput>true</xmlOutput> 
    <xmlOutputDirectory>${user.home}/outPutReports</xmlOutputDirectory> 
     </configuration> 
     </plugin> 
     </plugins> 
</reporting> 

</project> 

這我是從竹獲取日誌如下所示。

build 06-Jan-2014 18:55:19 [INFO] BUILD FAILURE 
build 06-Jan-2014 18:55:19 [INFO] ------------------------------------------------------------------------ 
build 06-Jan-2014 18:55:19 [INFO] Total time: 0.554s 
build 06-Jan-2014 18:55:19 [INFO] Finished at: Mon Jan 06 08:25:19 UTC 2014 
build 06-Jan-2014 18:55:19 [INFO] Final Memory: 3M/15M 
build 06-Jan-2014 18:55:19 [INFO] ------------------------------------------------------------------------ 
build 06-Jan-2014 18:55:19 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project portalogue: Cannot create resource output directory: /home/bamboo/myapp/portalogue/target/portalogue1/WEB-INF/classes/com/xti/portalogue/application/db/hibernate -> [Help 1] 
build 06-Jan-2014 18:55:19 [ERROR] 
build 06-Jan-2014 18:55:19 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
build 06-Jan-2014 18:55:19 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 
build 06-Jan-2014 18:55:19 [ERROR] 
build 06-Jan-2014 18:55:19 [ERROR] For more information about the errors and possible solutions, please read the following articles: 
build 06-Jan-2014 18:55:19 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
simple 06-Jan-2014 18:55:19 Failing task since return code of [/opt/maven-3.0/bin/mvn --batch-mode -Djava.io.tmpdir=/tmp/MAV-POR-CCB process-resources] was 1 while expected 0 
simple 06-Jan-2014 18:55:19 Finished task 'Process Resources' 
simple 06-Jan-2014 18:55:19 Running post build plugin 'Artifact Copier' 
simple 06-Jan-2014 18:55:19 Running post build plugin 'NCover Results Collector' 
simple 06-Jan-2014 18:55:19 Running post build plugin 'Clover Results Collector' 
simple 06-Jan-2014 18:55:19 Finalising the build... 
simple 06-Jan-2014 18:55:19 Stopping timer. 
simple 06-Jan-2014 18:55:19 Build MAV-POR-CCB-23 completed. 

如果有人知道發生了什麼問題,請讓我知道。

+0

您應該檢查:' $ {user.home}/myapp/portalogue/target /'導致user.home在Maven構建中不是一個好主意。只需將'.hbm.xml'放到'src/main/resources /'文件夾中,它們就會自動複製。 – khmarbaise

+0

謝謝khmarbaise。我厭倦了將hbm.xml文件保留在那裏。但它沒有被複制到目標文件夾中的所需文件夾。所以,我使用這個插件將文件複製到所需的文件夾。 – Anup

回答

0

您可以登錄到您的彈性實例,將用戶切換到竹(竹)運行的用戶,然後嘗試製作您指定的目錄。可能它是一個受限制的路徑。

基本上是: 尋找ssh鍵和竹子實例的IP,登錄,則:

蘇竹

的mkdir /家用/竹/ MYAPP/portalogue /目標/ portalogue1/WEB-INF /類/ COM/XTI/portalogue /應用/數據庫/休眠

或者在此之前,你可以登錄到竹/彈性實例並執行maven的目標對自己與-EX開關,檢查什麼樣的詳細的錯誤信息它給你。

+0

我確實在本地機器上創建了所需的文件夾結構,並且它在沒有資源插件的情況下對本地工作正常。現在,當我嘗試更改EC2實例上的文件夾結構時,無法刪除以前的文件。可能是許可問題。任何人都可以幫助我解決這個問題? – Anup

+0

正如我所說的,登錄到amazon實例並嘗試與竹用戶創建文件夾結構。不要在本地嘗試東西,只需登錄到EC2,將用戶切換到竹用戶,然後嘗試製作該目錄。 –