2013-12-18 3 views
2

내가 SRC/메인/웹 애플리케이션 .FOR 내부에 동봉 된 모든 컨텐츠를 포함 아마존 S3 (단순 스토리지 서비스)에 내 프로젝트 저장소에서 정적 콘텐츠를 업로드 할 플러그인 받는다는을 사용하여 정적 자원하는 빌드 시간에 이러한 리소스 업로드를 자동화하려면 메이븐 플러그인을 사용해야합니다.업로드 아마존 S3 서버는

것은 내가 특히 몇 등 받는다는 플러그인 우연히 연구하는 동안 :

  1. S3 업로드 - 받는다는 - 플러그인 (참조 문서 here) - 그것은 한 번
  2. 에서 단일 파일 업로드를 지원합니다 s3-static-uploader (문서 here 참조) - 기대할만한 흥미로운 전망이지만 최소한의 기능을 사용할 수는 있지만
  3. aws -parent (문서 here 참조) -no 공식 받는다는가 해제하지만 공유 S3-정전기 업 로더에 근접하고 내가 그것을 작동하게 할 수 없습니다 플러그인이
  4. JetS3t를 (해제 참조 문서 here)

I 이러한 모든 플러그인을 시도하고 내 목표를 달성하지 못할 때마다.

내가 S3-정전기 업 로더을 사용하는 동안 내 목표를 달성하기 위해 온 닫기 내 치어는

<plugin> 
     <groupId>io.pst.mojo</groupId> 
     <artifactId>s3-static-uploader-plugin</artifactId> 
     <version>1.1</version> 
     <configuration> 
      <accessKey>${aws.accessKey}</accessKey> 
      <secretKey>${aws.secretKey}</secretKey> 
      <bucketName>${aws.bucketName}</bucketName> 
      <refreshExpiredObjects>true</refreshExpiredObjects> 
      <includes> 
       <include> 
        <bind> 
         <!-- Could be path expressions or reg. expressions --> 
         <pattern>%regex[([^\s]+(\.(?i)(jpg|png|gif|bmp|tif|pdf|swf|eps))$)]</pattern> 
         <metadataId>static</metadataId> 
        </bind> 
       </include> 
       <include> 
        <bind> 
         <pattern>%regex[([^\s]+(\.(?i)(css|js))$)]</pattern> 
         <metadataId>volatile</metadataId> 
        </bind> 
       </include> 
       <include> 
        <bind> 
         <!-- Extension less files --> 
         <pattern>%regex[^[^.]+$]</pattern> 
         <metadataId>volatile-naked</metadataId> 
        </bind> 
       </include> 
      </includes> 
      <excludes> 
       <exclude>WEB-INF/.*</exclude> 
      </excludes> 
      <metadatas> 
       <metadata> 
        <id>static</id> 
        <cacheControl>public</cacheControl> 
        <contentEncoding>plain</contentEncoding> 
        <contentType>text/html</contentType> 
        <cannedAcl>PublicRead</cannedAcl> 
       </metadata> 
       <metadata> 
        <id>static-longlived</id> 
        <cacheControl>public</cacheControl> 
        <contentEncoding>plain</contentEncoding> 
          <contentType>text/html</contentType> 
        <cannedAcl>PublicRead</cannedAcl> 
       </metadata> 
       <metadata> 
        <id>volatile</id> 
        <cacheControl>private</cacheControl> 
        <contentEncoding>plain</contentEncoding> 
        <contentType>text/html</contentType> 
        <cannedAcl>PublicRead</cannedAcl> 
       </metadata> 
       <metadata> 
        <id>volatile-naked</id> 
        <cacheControl>private</cacheControl> 
        <contentEncoding>plain</contentEncoding> 
        <contentType>text/html</contentType> 
        <cannedAcl>PublicRead</cannedAcl> 
       </metadata> 
      </metadatas> 
     </configuration> 
     <executions> 
      <execution> 
       <goals> 
        <goal>upload</goal> 
       </goals> 
      </execution> 
     </executions> 
    </plugin> 

처럼 보이지만 받는다는가 설치에 하나의 파일을 업로드하고 실패를 구축 보여줍니다 다음 파일에 대한 메시지를 다음과 :

목표를 io.pst.mojo을 실행하지 못했습니다 : S3-정전기 업 로더 - 플러그인 : 1.1 : 프로젝트 (기본-CLI) 업로드

그리고 다음 받는다는에>

설치 - 액세스가 거부 : sbworkbenchnavigation-포틀릿 : /home/pawal/sbworkbench/portlets/sbworkbenchnavigation-portlet/src/main/webapp/css/main.css 파일을 처리 할 수 ​​없습니다 다음 파일에 대해 동일한 오류가 표시됩니다. 모든 파일이 동일한 프로세스에서 반복 된 후 빌드에 성공 메시지가 표시됩니다.

는 질문 :

  1. 것은 내가 뭔가 잘못을하고 있는가 .I이 플러그인 문서 정확하게 따랐다 (을 나는 생각).
  2. Amazion s3 서버에 정적 컨텐츠를 업로드하는 데 사용할 수있는 다른 maven 플러그인이 있습니까?

답변

3

동일 S3 - 왜건 확장 및 마차 플러그인의 조합에 의해 달성 나타납니다

.m2/Settings.XML의

<servers> 
    <server> 
     <id>aws-release</id> 
     <username>ASFFDSFDSFDSFDSFSFDF</username> 
     <password>Hmasdflaskdjflksdjflaskdjflasjdflkasjdfl</password> 
    </server> 
</servers> 

의 pom.xml

<build> 
    <extensions> 
     <extension> 
      <groupId>org.kuali.maven.wagons</groupId> 
      <artifactId>maven-s3-wagon</artifactId> 
      <version>1.2.1</version> 
     </extension> 
    </extensions> 
    <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>wagon-maven-plugin</artifactId> 
     <version>1.0</version> 
     <executions> 
      <execution> 
       <id>deploy-release</id> 
       <phase>deploy</phase> 
       <goals> 
        <goal>upload</goal> 
       </goals> 
       <configuration> 
        <serverId>aws-release</serverId> 
        <url>s3://${bucket}/releases/</url> 
        <fromDir>${project.build.directory}</fromDir> 
        <toDir>${project.version}</toDir> 
        <includes> 
         ${project.artifactId}-${project.version}.jar, 
         ${project.artifactId}-${project.version}.dmg, 
         ${project.artifactId}-${project.version}-shaded.jar, 
        </includes> 
       </configuration> 
      </execution> 
     </executions> 
    </plugin> 
</build> 
+0

완벽하게 작동했습니다. – rrhartjr