Jenkins Maven project

Create a Maven project that builds a Docker image and then scans it for vulnerability and compliance issues.

Configuring Maven

Configure Maven.
  1. Go to the Jenkins top page.
  2. Click Manage Jenkins.
  3. Select Global Tool Configuration.
  4. Scroll down to the Maven section (Not Maven Configuration), and click Add Maven.

Setting up a Maven project for container images

Set up a Jenkins Maven project.
  1. Go to the Jenkins top page.
  2. Create a new project.
    1. Click
      New Item
    2. In
      name, enter a name for your project.
    3. Select
      Maven project
    4. Click
  3. Add a build step.
    1. Scroll down to the
      Pre steps
    2. In the
      Add pre-build step
      drop-down list, select
      Execute shell
    3. In the
      text box, enter the following:
      echo "Creating Dockerfile..." echo "FROM imiell/bad-dockerfile:latest" > Dockerfile echo 'docker build --no-cache -t test/test-image:0.1 .' > chmod +x echo "Creating POM file..." cat > pom.xml << EOF <?xml version="1.0" encoding="UTF-8"?> <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>groupId</groupId> <artifactId>artifactid</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>projectName</name> <properties> <>UTF-8</> </properties> <build> <plugins> <plugin> <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> <executions> <execution> <id>Build Image</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable></executable> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> EOF
  4. Add a build step that scans the container image(s) for vulnerabilities.
    1. In the
      Add build step
      drop-down list, select
      Scan Prisma Cloud Images