2013-03-06 4 views
1

Я новичок как Maven и Дженкинс так, медведь со мной здесь ...Строительство Maven проектов с Дженкинс

У меня есть проект Maven, который строит правильно, когда я бегу МВН установки внутри проекта , но когда я пытаюсь построить через Jenkins, никакие зависимости не могут быть разрешены вообще. Я что-то упустил/ввернул что-то в настройках Maven или Jenkins?

POM проекта и .m2/settings.xml ниже ...

pom.xml

<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> 
<groupId>project</groupId> 
<artifactId>ProjectGUI</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>jar</packaging> 
<name>ProjectGUI</name> 
<url>http://maven.apache.org</url> 

<repositories> 
<repository> 
    <id>central</id> 
    <url>http://server:8081/nexus/content/groups/public</url> 
    <releases><enabled>true</enabled></releases> 
    <snapshots><enabled>true</enabled></snapshots> 
</repository> 
</repositories> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration>     
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
     <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>package-jar-with-dependencies</id> 
        <phase>package</phase> 
        <goals> 
         <goal>single</goal> 
        </goals> 
        <configuration> 
          <appendAssemblyId>false</appendAssemblyId> 
         <descriptorRefs> 
          <descriptorRef>jar-with-dependencies</descriptorRef> 
         </descriptorRefs> 
         <archive> 
                 <manifestEntries> 
                  <Manifest- Version>1.0</Manifest-Version> 
                  <Main-Class>project.Main</Main-Class> 
                  <SplashScreen- Image>splash.png</SplashScreen-Image> 
                 </manifestEntries> 
                </archive> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <version>2.1</version> 
      <configuration> 
       <archive> 
        <manifestEntries> 
         <Manifest-Version>1.0</Manifest-Version> 
         <Main-Class>project.Main</Main-Class> 
         <SplashScreen-Image>splash.png</SplashScreen-Image> 
        </manifestEntries> 
       </archive> 
      </configuration> 
     </plugin>  
    </plugins> 
</build> 
<properties> 
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<dependencies> 
<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>3.8.1</version> 
    <scope>test</scope> 
</dependency> 
<dependency> 
    <groupId>com.googlecode.lambdaj</groupId> 
    <artifactId>lambdaj</artifactId> 
    <version>2.3.3</version> 
</dependency> 
<dependency> 
    <groupId>org.hamcrest</groupId> 
    <artifactId>hamcrest-all</artifactId> 
    <version>1.3</version> 
</dependency> 
<dependency> 
    <groupId>javax.media</groupId> 
    <artifactId>jmf</artifactId> 
    <version>2.1.1e</version> 
</dependency> 
<dependency> 
    <groupId>ch.qos.logback</groupId> 
    <artifactId>logback-classic</artifactId> 
    <version>1.0.0</version> 
</dependency> 
<dependency> 
    <groupId>jfree</groupId> 
    <artifactId>jfreechart</artifactId> 
    <version>1.0.13</version> 
</dependency> 
<dependency> 
    <groupId>com.jidesoft</groupId> 
    <artifactId>jide-charts</artifactId> 
    <version>3.4.8</version> 
</dependency> 
<dependency> 
    <groupId>com.jidesoft</groupId> 
    <artifactId>jide-common</artifactId> 
    <version>3.4.8</version> 
</dependency> 
<dependency> 
    <groupId>org.jogamp.gluegen</groupId> 
    <artifactId>gluegen-rt-main</artifactId> 
    <version>2.0-rc11</version> 
</dependency> 
<dependency> 
    <groupId>org.jogamp.jogl</groupId> 
    <artifactId>jogl-all-main</artifactId> 
    <version>2.0-rc11</version> 
</dependency> 
<dependency> 
    <groupId>org.jzy3d</groupId> 
    <artifactId>jzy3d</artifactId> 
    <version>0.9</version> 
</dependency> 
<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-api</artifactId> 
    <version>1.7.2</version> 
</dependency> 
</dependencies> 
</project> 

.m2/settings.xml

<settings> 
<mirrors> 
<mirror> 
    <!--This sends everything else to /public --> 
    <id>nexus</id> 
    <mirrorOf>central</mirrorOf> 
    <url>http://server:8081/nexus/content/groups/public</url> 
</mirror> 
</mirrors> 
<profiles> 
<profile> 
    <id>nexus</id> 
    <!--Enable snapshots for the built in central repo to direct --> 
    <!--all requests to nexus via the mirror --> 
    <repositories> 
    <repository> 
     <id>central</id> 
     <url>http://central</url> 
     <releases><enabled>true</enabled></releases> 
     <snapshots><enabled>true</enabled></snapshots> 
    </repository> 
    </repositories> 
<pluginRepositories> 
    <pluginRepository> 
     <id>central</id> 
     <url>http://central</url> 
     <releases><enabled>true</enabled></releases> 
     <snapshots><enabled>true</enabled></snapshots> 
    </pluginRepository> 
    </pluginRepositories> 
</profile> 
</profiles> 
<activeProfiles> 
<!--make the profile active all the time --> 
<activeProfile>nexus</activeProfile> 
</activeProfiles> 
</settings> 
+0

Ваш плагин Jenkins maven указывает на тот же .m2? Работает ли Jenkins на той же машине, что и ваш .m2 каталог –

+1

Помогает ли это? -> [см. это] (http://blog.cloudbees.com/2012/01/painless-maven-builds-with-jenkins.html) – Anubhab

+0

Дженкинс указывает на ** ~/.m2/репозиторий ** (и все зависимости есть, я проверил), и он находится на одной машине. –

ответ

3

Это , возможно, потому что Дженкинс (если она работает на другом компьютере) не знает дополнительного репозитория, идентифицированного как central, который представляется частным nexus экземпляром в вашей доменной зоне.

Установка собственного размера settings.xml Jenkin зависит от способа установки.

В моем случае (родной ubuntu install) дом Дженкинса /usr/lib/jenkins. Возможно, вы можете скопировать местное settings.xml в Jenkins '/usr/lib/jenkins/.m2/?

+0

ОП сказал, что Дженкинс был на той же машине, я думаю –

+0

Да, он это сделал. Я скучаю по этому. –

+10

ой, Дженкинс это она? – amphibient

Смежные вопросы