Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions ant/src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,22 @@ Apache Ivy can be used to automatically provision the required dependencies.
This approach helps ensure consistent versions across multiple environments
and simplifies setup.

Below is an example `build.xml` configuration using Apache Ivy.
### 1. `ivy.xml` (Dependency Declarations)

Create an `ivy.xml` file in your project directory with:

```xml
<ivy-module version="2.0">
<info organisation="example" module="dependency-check-ant-example"/>
<dependencies>
<dependency org="org.owasp" name="dependency-check-ant" rev="${project.version}"/>
</dependencies>
</ivy-module>
```
> Replace `${project.version}` with your desired Dependency-Check version, such as `8.4.0`.

### 2. `build.xml` (Ant/Ivy Integration)

#[[
```xml
<project name="dependency-check-ivy" default="check"
xmlns:ivy="antlib:org.apache.ivy.ant">
Expand All @@ -55,8 +68,7 @@ Below is an example `build.xml` configuration using Apache Ivy.
<ivy:retrieve pattern="lib/[artifact]-[revision].[ext]"/>

<!-- Register Dependency-Check Ant task -->
<taskdef
resource="dependency-check-taskdefs.properties">
<taskdef resource="dependency-check-taskdefs.properties">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
Expand All @@ -67,10 +79,16 @@ Below is an example `build.xml` configuration using Apache Ivy.
<target name="check">
<dependency-check
projectName="Example Project"
scanSet="src"
format="HTML"/>
reportFormat="HTML">
<fileset dir="src">
<include name="**/*.jar"/>
</fileset>
</dependency-check>
</target>
</project>
```

Both `build.xml` and `ivy.xml` must be located in the same directory, unless Ivy is configured otherwise.

It is important to understand that the first time this task is executed it may
take 10 minutes or more as it downloads and processes the data from the National
Expand Down
16 changes: 15 additions & 1 deletion ant/src/test/resources/build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dependency-Check Test Build" default="test.fileset" basedir=".">
<!-- Load Ivy Ant tasks -->
<taskdef resource="org/apache/ivy/ant/antlib.xml"/>

<taskdef name="dependency-check" classname="org.owasp.dependencycheck.taskdefs.Check" />
<!-- Resolve dependencies defined in ivy.xml into the 'lib' folder -->
<ivy:settings/>
<ivy:retrieve pattern="lib/[artifact]-[revision].[ext]"/>

<!-- Register Dependency-Check Ant task with correct classpath -->
<taskdef resource="dependency-check-taskdefs.properties">
<classpath>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<!-- <taskdef name="dependency-check" classname="org.owasp.dependencycheck.taskdefs.Check" />-->

<!-- HACK: disabling ossindex analyzer as it may cause failures due to rate-limiting -->

Expand Down
6 changes: 6 additions & 0 deletions ant/src/test/resources/ivy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ivy-module version="2.0">
<info organisation="example" module="dependency-check-ant-example"/>
<dependencies>
<dependency org="org.owasp" name="dependency-check-ant" rev="8.4.0"/>
</dependencies>
</ivy-module>