如何在jenkins中安装这些项目,以便只能在一个项目中提供选项

时间:2019-03-13 10:17:33

标签: maven jenkins

Project TestMV


I have project TestMV.Which has dependency of project TestMV1.
I have deployoed thease project in jenkins sepratly and pass the parameter in
Goals and option section  like install -Dversion=13.2.00 and this is done in 
project TestMV1 configuration as well.what I want to configure this install - 
Dversion=13.2.00 in project TestMV only and this should be shared in project 
TestMV1 in jenkins job.
also. and more this should be work in eclipse also.  


<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>com.TestMV</groupId>
  <artifactId>TestMV</artifactId>
  <version>${version}</version>
  <packaging>jar</packaging>

  <name>TestMV</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version>13.2.00</version>
  </properties>
  <dependencies>
  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.TestMV1</groupId>
      <artifactId>TestMV1</artifactId>
      <version>${version}</version>
       </dependency>
  </dependencies>
</project>

Project TestMV1

<modelVersion>4.0.0</modelVersion>
  <groupId>com.TestMV1</groupId>
  <artifactId>TestMV1</artifactId>
  <version>${version}</version>
  <packaging>jar</packaging>
  <name>TestMV1</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <version>13.2.00</version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

在项目TestMV配置的目标部分中传递install -dversion时。

我们如何才能将-dversion传递给jenkins中的项目b,而不是在jenkins中的项目TestMV1配置的目标部分中编写install -dversion。

TestMV项目具有TestMV1的依赖项

1 个答案:

答案 0 :(得分:0)

我在抽搐中创建了全局变量,并在目标和选项部分(例如install -Dversion = $ {version})中传递了该变量。在两个Maven项目中都完成了。

问题已解决。 谢谢