maven プロジェクトをジェンキンスでビルドするのに問題があります。プロジェクトは私のローカル マシンでは問題なくビルドされますが、Jenkins がビルドしようとするとビルドされません。
ローカルで、レポでホストされていない 2 つの依存関係があります。彼らです:
- 最初の.jar
- 2番目のjar
これが私のプロジェクトの構造です:
- -MyProject/
- ---images/...
- ---resources/...
- ---src/...
- ---first.jar
- ---second.jar
- ---pom.xml
- ---...
Maven は「first.jar」と「second.jar」を見つけることができないようで、リモートでダウンロードしようとします。
私はそれらをインストールしました
install:install-file -Dfile=first.jar -DgroupId=first -DartifactId=first -Dversion=1.0.0 -Dpackaging=jar
install:install-file -Dfile=second.jar -DgroupId=second -DartifactId=second -Dversion=1.0.0 -Dpackaging=jar
========================
POM.XML
ここに私のpom.xmlがあります:
<!-- This pom is now operational.-->
<!-- ****Compile with****: mvn compile -->
<!-- ****Create Executable with****: mvn package -->
<!-- ****Run with****: java -jar MYPROJECT-0.0.1-beta-jar-with-dependencies.jar [args]-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- MYPROJECT INFO -->
<groupId>Main</groupId>
<artifactId>MyProject</artifactId>
<version>0.0.1-beta</version>
<name>MyProject</name>
<packaging>jar</packaging>
<!-- DEPENDANCIES -->
<dependencies>
<dependency>
<groupId>first</groupId>
<artifactId>first</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>second</groupId>
<artifactId>second</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<!-- RESOURCES -->
<resources>
<resource>
<directory>src</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/images</directory>
<filtering>false</filtering>
<targetPath>images</targetPath>
</resource>
<resource>
<directory>${basedir}/resources</directory>
<filtering>false</filtering>
<targetPath>resources</targetPath>
</resource>
</resources>
<testResources>
<testResource>
<directory>src</directory>
</testResource>
</testResources>
<plugins>
<!-- For Java 6, you need to configure the maven-compiler-plugin. Add this to your pom.xml: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- CREATE EXECUTABLE JAR WITH DEPENDANCIES in target/MYPROJECT -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>Main.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<outputDirectory>${project.build.directory}/MYPROJECT</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- COPY RESOURCES to target/MYPROJECT -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/MYPROJECT</outputDirectory>
<resources>
<resource>
<directory>${basedir}/images</directory>
<filtering>false</filtering>
<targetPath>images</targetPath>
</resource>
<resource>
<directory>${basedir}/resources</directory>
<filtering>false</filtering>
<targetPath>resources</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
========================
ジェンキンス
そして、これが私のJenkins構成です:
- "建てる"
- 「最上位の Maven ターゲットを呼び出す」
- install:install-file -Dfile=first.jar -DgroupId=first -DartifactId=first -Dversion=1.0.0 -Dpackaging=jar
- もともとこれらは含まれていませんでしたが、ビルド内にインストールすれば機能するかもしれないと思っていましたが、機能しません。
- install:install-file -Dfile=first.jar -DgroupId=first -DartifactId=first -Dversion=1.0.0 -Dpackaging=jar
- 「最上位の Maven ターゲットを呼び出す」
- install:install-file -Dfile=second.jar -DgroupId=second -DartifactId=second -Dversion=1.0.0 -Dpackaging=jar
- 「最上位の Maven ターゲットを呼び出す」
- コンパイル
- 私もコンパイルしようとしました -gs /usr/share/maven2/conf/settings.xml -s /usr/share/maven2/conf/settings.xml )
- 「プライベートMavenリポジトリを使用する」を選択し、「グローバル設定ファイル」と「設定ファイル」を設定してみました
- コンパイル
- 「最上位の Maven ターゲットを呼び出す」
- パッケージ
- (パッケージ -gs /usr/share/maven2/conf/settings.xml -s /usr/share/maven2/conf/settings.xml も試しました)
- パッケージ
- 「最上位の Maven ターゲットを呼び出す」
========================
出力
Building in workspace /var/lib/jenkins/workspace/MyProject
Checkout:MyProject / /var/lib/jenkins/workspace/MyProject - hudson.remoting.LocalChannel@65565eae
Using strategy: Default
Last Built Revision: Revision 72e4cfcdd55427078cb0fb2c799c99e96ecb4ad8 (origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Commencing build of Revision 72e4cfcdd55427078cb0fb2c799c99e96ecb4ad8 (origin/master)
Checking out Revision 72e4cfcdd55427078cb0fb2c799c99e96ecb4ad8 (origin/master)
[MyProject] $ mvn install:install-file -Dfile=first.jar -DgroupId=first -DartifactId=first -Dversion=1.0.0 -Dpackaging=jar
/usr/lib/jvm/java
[INFO] Scanning for projects...
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
[INFO] Searching repository for plugin with prefix: 'install'.
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-install-plugin:2.2 and goal prefix is install
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-install-plugin:2.2 and goal prefix is install
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-install-plugin:2.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-install-plugin:2.2
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file {execution: default-cli}]
[INFO] Installing /var/lib/jenkins/workspace/MyProject/first.jar to /home/jenkins/.m2/repository/first/first/1.0.0/first-1.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Aug 19 10:05:11 PDT 2013
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[MyProject] $ mvn install:install-file -Dfile=second.jar -DgroupId=second -DartifactId=second -Dversion=1.0.0 -Dpackaging=jar
/usr/lib/jvm/java
[INFO] Scanning for projects...
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
[INFO] Searching repository for plugin with prefix: 'install'.
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-install-plugin:2.2 and goal prefix is install
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-install-plugin:2.2 and goal prefix is install
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-install-plugin:2.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-install-plugin:2.2
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file {execution: default-cli}]
[INFO] Installing /var/lib/jenkins/workspace/MyProject/second.jar to /home/jenkins/.m2/repository/second/second/1.0.0/second-1.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Mon Aug 19 10:05:18 PDT 2013
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[MyProject] $ mvn compile
/usr/lib/jvm/java
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-resources-plugin:2.6 and goal prefix is resources
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-compiler-plugin:2.0.2 and goal prefix is compiler
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-compiler-plugin:2.0.2
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Putting in plugin descriptor list org.apache.maven.plugins:maven-assembly-plugin:2.4 and goal prefix is assembly
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-assembly-plugin:2.4
*DEBUG*: Constructed plugin version key is org.apache.maven.plugins:maven-resources-plugin:2.6
[INFO] [resources:resources {execution: default-resources}]
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 35 resources
[INFO] Copying 126 resources to images
[INFO] Copying 18 resources to resources
Downloading: http://repo1.maven.org/maven2/first/first/1.0.0/first-1.0.0.pom
[INFO] Unable to find resource 'first:first:pom:1.0.0' in repository central (http://repo1.maven.org/maven2)
[WARNING] Skipping jpp repository file:///usr/share/maven2/repository in vanilla mode
Downloading: http://repo1.maven.org/maven2/second/second/1.0.0/second-1.0.0.pom
[INFO] Unable to find resource 'second:second:pom:1.0.0' in repository central (http://repo1.maven.org/maven2)
[WARNING] Skipping jpp repository file:///usr/share/maven2/repository in vanilla mode
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 24 source files to /var/lib/jenkins/workspace/MyProject/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/var/lib/jenkins/workspace/MyProject/src/Actions/EditorActions.java:[119,15] error while writing Actions.EditorActions.ListCheckBox: /var/lib/jenkins/workspace/MyProject/target/classes/Actions/EditorActions$ListCheckBox.class (Permission denied)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Mon Aug 19 10:05:35 PDT 2013
[INFO] Final Memory: 14M/53M
[INFO] ------------------------------------------------------------------------
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
何か案は?