2017-04-11 41 views
0

Jenkinsビルドの一環として、JenkinsはMavenを使用して、プロジェクトのルートにあるpom.xmlファイルを使用します。今のところはかなりノーオペレーションです:Node.jsプロジェクト用のMaven経由で "npm install" +テストスクリプトを実行

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.dqsalpha-dev.app</groupId> 
    <artifactId>dqsalpha</artifactId> 
    <version>1</version> 
</project> 

私はこのPOMファイルに一つのことを追加したい - 私はmaven buildが実行されるとき(それだけでシェルスクリプトです)テストを実行したいです。

pomファイル経由でMavenビルドにテストを追加する最も簡単な方法は何ですか?このような

何か:それを除いて

<project> 
     <modelVersion>4.0.0</modelVersion> 
     <groupId>com.dqsalpha-dev.app</groupId> 
     <artifactId>dqsalpha</artifactId> 
     <version>1</version> 
     <test> 
      <bash> 
      @test.sh 
      </bash> 
     </test> 
    </project> 

は完全に間違っています。私はおそらく、おそらくNode.jsの依存関係もnpm installでインストールする必要があることを理解しています。

私はこの試みた:

https://bitbucket.org/atlassian/bash-maven-plugin

をそして、私のpom.xmlは、次のようになります。

<project> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.dqsalpha-dev.app</groupId> 
    <artifactId>dqsalpha</artifactId> 
    <version>1</version> 
    <build> 
     <plugins> 
      <plugin> 

       <groupId>com.atlassian.maven.plugins</groupId> 
       <artifactId>bash-maven-plugin</artifactId> 
       <version>1.0-SNAPSHOT</version> 
       <executions> 
        <execution> 
         <id>test</id> 
         <phase>integration-test</phase> 
         <goals> 
          <goal>run</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <script> 
         npm install; 
         ./test.sh 
        </script> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
    <properties> 
     <example.one>Variable replacement is available from Maven.</example.one> 
    </properties> 
    <dependencies> 
     <dependency> 
      <groupId>com.atlassian.maven.plugins</groupId> 
      <artifactId>bash-maven-plugin</artifactId> 
      <version>1.0-SNAPSHOT</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
</project> 

が、その後、私はこのエラーを取得する:

$ mvn clean install 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building dqsalpha 1 
[INFO] ------------------------------------------------------------------------ 
[WARNING] The POM for com.atlassian.maven.plugins:bash-maven-plugin:jar:1.0-SNAPSHOT is missing, no dependency information available 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.187 s 
[INFO] Finished at: 2017-04-11T16:09:24-07:00 
[INFO] Final Memory: 8M/309M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Plugin com.atlassian.maven.plugins:bash-maven-plugin:1.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact com.atlassian.maven.plugins:bash-maven-plugin:jar:1.0-SNAPSHOT -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException 

答えて

0

あなたが使用することができますexec-maven-plugin

<plugin> 
    <artifactId>exec-maven-plugin</artifactId> 
    <groupId>org.codehaus.mojo</groupId> 
    <executions> 
     <execution> 
      <id>test1</id> 
      <phase>package</phase> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      <configuration> 
       <executable>${basedir}/test.sh</executable> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 
関連する問題