Skip to content

Commit

Permalink
Merge branch 'svasek:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
svasek committed Dec 22, 2021
2 parents 0d07054 + 755f7a0 commit 7566c7c
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.settings/
.idea/
.mvn/
target/
work/
lib/
Expand Down
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Changelog

### Newer versions
See [GitHub releases](https://github.com/jenkinsci/antexec-plugin/releases)

### 1.11
Release date: _2015-08-18_

- Passing parameters and properties through the generated property file instead of command-line which caused problems (especially on Windows)
- Changed core dependency from `1.480` to `1.596`
- Updated dependency on "token-macro" plugin (1.10)
- Dropped compatibility with Java 1.5

### 1.10
Release date: _2013-10-31_

- Load environment variables with `<property environment="env"/>` by default, so they are accessible via ${env.VARIABLE}
- Fixed missing job options in command line properties

### 1.9
Release date: _2013-07-15_

- Build files are now automatically deleted by default so you need to update job configuration if you want to keep them
- Fixing upgrade issue with ant-contrib in version 1.8

### 1.8
Release date: _2013-06-28_

- Remove archive copying of buildfile to job directory
- Cleanup dependencies in pom.xml

### 1.7
Release date: _2013-06-24_

- Added option to keep build files for each build step, it's deleted by default now
- Added dependency on "ant" plugin (1.2)
- Added dependency on "token-macro" plugin (1.7)
- Option for disabling ant-contrib has been moved to build step configuration
- Changed dependency to core 1.480

### 1.6
Release date: _2012-08-28_

- Fixing typo in extendedScriptSource

### 1.5
Release date: _2012-06-21_

- Fixing typo

### 1.4
Release date: _2012-06-20_

- Fixing build file when extended script source is null

### 1.3
Release date: _2012-06-06_

- First public release
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,57 @@
Jenkins AntExec Plugin
=========================
# Jenkins AntExec Plugin

This plugin permits Jenkins to run Apache Ant code directly in build steps.
This plugin makes it possible to run Apache Ant code directly from build steps of your Jenkins-CI.

See [AntExec Plugin](https://wiki.jenkins.io/display/JENKINS/AntExec+plugin) for more information.
## Features
- Adding build step to execute Ant code
- Bundled ant-contrib to support ant-contrib tasks (needs to be enable in global config)
- Easy to write simple Ant build file directly into the build step
- Ability to write the fully functional Ant build file directly into Jenkins as a build step
- You can reuse the build file created by the build step
- Supports multi-line parameters

## Some use cases
- To do some platform independent tasks
- To do some advanced build preparation steps
- To write the custom Ant build file maintained by Jenkins
- To maintain custom Ant build file when you don't have access into the VCS of the current project
- To write Ant targets that use multi-line text parameters (currently not possible using the core Ant plugin)
- And much more (wink)

## Support for multi-line text parameters
If your job uses text parameters (as opposed to string parameters) and the parameter values contain newline characters, the core ant plugin fails with the following syntax error:

```
Building in workspace c:\svn\automation\baf
baf $ cmd.exe /C '"ant.bat "-Dmulti_line_text=This is line 1
This is line 2
This is line3" usage && exit %%ERRORLEVEL%%"'
The syntax of the command is incorrect.
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
```

The problem is that parameters are passed verbatim to the command line, and if they contain any line breaks, cmd.exe will discard everything after the first line break, inevitably leading to a syntax error. The AntExec plugin gets around this problem by saving the build parameters into a .properties file on the fly and loading this file into the Ant session automatically. This also means that you can no longer verify in the build log the list of parameters that were handed down to Ant. If you need this (presumably for debugging purposes) then check the Keep buildfile check box, which will cause the plugin to retain the build file, as well as the parameter properties file, in the workspace of the plugin.

## Usage Screenshots

### Adding new build step
![](docs/images/01.Add_buildstep.png)

### New AntExec build step
![](docs/images/02.New_AntExec_Step.png)

### New AntExec build step with 1st level of advanced options
![](docs/images/03.New_AntExec_Step_Adv1.png)

### New AntExec build step with 2nd level of advanced options
![](docs/images/04.New_AntExec_Step_Adv2.png)

### Code Example
![](docs/images/05.Example1.png)

### Code Validation Example
![](docs/images/06.Example2-Validation.png)


For release history, please see [changelog](CHANGELOG.md).
Binary file added docs/images/01.Add_buildstep.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/02.New_AntExec_Step.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/03.New_AntExec_Step_Adv1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/04.New_AntExec_Step_Adv2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/05.Example1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06.Example2-Validation.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 32 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<revision>1.12</revision>
<changelist>SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/antexec-plugin</gitHubRepo>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jenkins.version>2.289.1</jenkins.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<java.level>8</java.level>
Expand All @@ -10,20 +14,21 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.32</version>
<relativePath />
</parent>

<artifactId>antexec</artifactId>
<version>1.12-SNAPSHOT</version>
<version>${revision}-${changelist}</version>
<packaging>hpi</packaging>
<name>AntExec</name>
<description>Adds new build step for running directly written Apache Ant code</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/AntExec+plugin</url>
<url>https://github.com/jenkinsci/antexec-plugin</url>

<developers>
<developer>
<id>svasek</id>
<name>Milos Svasek</name>
<email>svasek@gmail.com</email>
<email>Milos@Svasek.net</email>
<timezone>+1</timezone>
<roles>
<role>Project Owner</role>
Expand All @@ -42,13 +47,33 @@
</licenses>

<scm>
<connection>scm:git:https://github.com/jenkinsci/antexec-plugin.git</connection>
<developerConnection>scm:git:https://github.com/jenkinsci/antexec-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/antexec-plugin</url>
<tag>HEAD</tag>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:https://github.com/${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.289.x</artifactId>
<version>1055.v9637a690f734</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>symbol-annotation</artifactId>
<version>1.23</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>3.22</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ant</artifactId>
Expand Down

0 comments on commit 7566c7c

Please sign in to comment.