Skip to content

Commit b0adf8a

Browse files
committed
Ammended the changes required
1 parent 8af422e commit b0adf8a

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

ant/src/site/markdown/index.md.vm

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,22 @@ Apache Ivy can be used to automatically provision the required dependencies.
4040
This approach helps ensure consistent versions across multiple environments
4141
and simplifies setup.
4242

43-
Below is an example `build.xml` configuration using Apache Ivy.
43+
### 1. `ivy.xml` (Dependency Declarations)
44+
45+
Create an `ivy.xml` file in your project directory with:
46+
47+
```xml
48+
<ivy-module version="2.0">
49+
<info organisation="example" module="dependency-check-ant-example"/>
50+
<dependencies>
51+
<dependency org="org.owasp" name="dependency-check-ant" rev="${project.version}"/>
52+
</dependencies>
53+
</ivy-module>
54+
```
55+
> Replace `${project.version}` with your desired Dependency-Check version, such as `8.4.0`.
56+
57+
### 2. `build.xml` (Ant/Ivy Integration)
4458

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

5770
<!-- Register Dependency-Check Ant task -->
58-
<taskdef
59-
resource="dependency-check-taskdefs.properties">
71+
<taskdef resource="dependency-check-taskdefs.properties">
6072
<classpath>
6173
<fileset dir="lib">
6274
<include name="*.jar"/>
@@ -67,10 +79,16 @@ Below is an example `build.xml` configuration using Apache Ivy.
6779
<target name="check">
6880
<dependency-check
6981
projectName="Example Project"
70-
scanSet="src"
71-
format="HTML"/>
82+
reportFormat="HTML">
83+
<fileset dir="src">
84+
<include name="**/*.jar"/>
85+
</fileset>
86+
</dependency-check>
7287
</target>
7388
</project>
89+
```
90+
91+
Both `build.xml` and `ivy.xml` must be located in the same directory, unless Ivy is configured otherwise.
7492

7593
It is important to understand that the first time this task is executed it may
7694
take 10 minutes or more as it downloads and processes the data from the National

ant/src/test/resources/build.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="Dependency-Check Test Build" default="test.fileset" basedir=".">
3+
<!-- Load Ivy Ant tasks -->
4+
<taskdef resource="org/apache/ivy/ant/antlib.xml"/>
35

4-
<taskdef name="dependency-check" classname="org.owasp.dependencycheck.taskdefs.Check" />
6+
<!-- Resolve dependencies defined in ivy.xml into the 'lib' folder -->
7+
<ivy:settings/>
8+
<ivy:retrieve pattern="lib/[artifact]-[revision].[ext]"/>
9+
10+
<!-- Register Dependency-Check Ant task with correct classpath -->
11+
<taskdef resource="dependency-check-taskdefs.properties">
12+
<classpath>
13+
<fileset dir="lib">
14+
<include name="*.jar"/>
15+
</fileset>
16+
</classpath>
17+
</taskdef>
18+
<!-- <taskdef name="dependency-check" classname="org.owasp.dependencycheck.taskdefs.Check" />-->
519

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

ant/src/test/resources/ivy.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ivy-module version="2.0">
2+
<info organisation="example" module="dependency-check-ant-example"/>
3+
<dependencies>
4+
<dependency org="org.owasp" name="dependency-check-ant" rev="8.4.0"/>
5+
</dependencies>
6+
</ivy-module>

0 commit comments

Comments
 (0)