Skip to content

Commit

Permalink
Helidon Dependency Maven Plugin (#1050)
Browse files Browse the repository at this point in the history
- Add a new plugin to aggressively cache all Maven dependencies
  • Loading branch information
romain-grecourt authored Jul 25, 2024
1 parent 4f8dd49 commit fc67715
Show file tree
Hide file tree
Showing 12 changed files with 1,088 additions and 0 deletions.
45 changes: 45 additions & 0 deletions maven-plugins/dependency-maven-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Helidon Maven Plugin

This plugin provides Maven goals to manipulate dependencies.

#### Goals

* [go-offline](#goal-go-offline)

## Goal: `go-offline`

A goal to aggressively cache all Maven dependencies.

This goal requires a direct execution.

### Optional Parameters

| Property | Type | Default<br/>Value | Description |
|-----------------------------|---------|-------------------------|---------------------------------------------------------------------------------------------------------|
| pomScanningIdentity | List | `pom.xml` | List of relative paths that must exist for a directory to be resolved as a Maven module |
| pomScanningIncludes | List | `**/*` | List of glob expressions used as an include filter for directories that may contain pom.xml files |
| pomScanningExcludes | List | `**/target/**,**/src**` | List of glob expressions used as an exclude filter for directories that may contain pom.xml files |
| pomIncludes | List | `*:*:*` | List of include filters (`groupId:artifactId:packaging` with wildcard support) of scanned pom.xml files |
| pomExcludes | List | `[]` | List of exclude filters (`groupId:artifactId:packaging` with wildcard support) of scanned pom.xml files |
| includeSnapshots | boolean | `false` | Specifies if `-SNAPSHOT` artifacts should be processed |
| includeDependencies | boolean | `true` | Specifies if dependencies should be processed |
| includeDependencyManagement | boolean | `false` | Specifies if dependency management should be processed |
| includePlugins | boolean | `true` | Specifies if plugins should be processed |
| includePluginManagement | boolean | `false` | Specifies if plugin management should be processed |
| traverse | boolean | `true` | Specifies if the resolution should traverse |
| profileIncludes | List | `*` | Profile include patterns (with wildcard support) |
| profileExcludes | List | `[]` | Profile exclude patterns (with wildcard support) |
| scopeIncludes | List | `*` | Transitive scope exclude patterns (with wildcard support) |
| scopeExcludes | List | `test` | Transitive scope exclude patterns (with wildcard support) |
| includeOptional | boolean | `true` | Specifies if optional transitive dependencies should be processed |
| failOnError | boolean | `false` | Specifies if the build will fail if there are errors during execution or not |
| skip | boolean | `false` | Skip this goal execution |

The above parameters are mapped to user properties of the form `helidon.dependency.offline.PROPERTY`.
`List` values must be comma separated.

### General usage

```shell
mvn helidon-dependency:go-offline
```
148 changes: 148 additions & 0 deletions maven-plugins/dependency-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023, 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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">
<parent>
<artifactId>helidon-build-tools-project</artifactId>
<groupId>io.helidon.build-tools</groupId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>helidon-dependency-maven-plugin</artifactId>
<name>Helidon Dependency Maven Plugin</name>
<packaging>maven-plugin</packaging>

<properties>
<maven.compiler.release>17</maven.compiler.release>
<spotbugs.skip>true</spotbugs.skip>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.helidon.build-tools.common</groupId>
<artifactId>helidon-build-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.build-tools.common</groupId>
<artifactId>helidon-build-common-maven</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.build-tools.common</groupId>
<artifactId>helidon-build-common-maven-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.build-tools.common</groupId>
<artifactId>helidon-build-common-test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<goalPrefix>helidon-dependency</goalPrefix>
<skipErrorNoDescriptorsFound>false</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2024 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

invoker.name = Test1
invoker.description = Invoke helidon-dependency:go-offline
invoker.goals = helidon-dependency:go-offline
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<parent>
<groupId>io.helidon.build-tools.dependency.tests</groupId>
<artifactId>parent</artifactId>
<version>@project.version@</version>
</parent>
<artifactId>test-module1</artifactId>
<name>Test Dependency 1 - Module 1</name>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.acme1;

/**
* Acme1.
*/
public class Acme1 {

private Acme1(){
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<parent>
<groupId>io.helidon.build-tools.dependency.tests</groupId>
<artifactId>parent</artifactId>
<version>@project.version@</version>
</parent>
<artifactId>test-module2</artifactId>
<name>Test Dependency 1 - Module 2</name>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.acme2;

/**
* Acme2.
*/
public class Acme2 {

private Acme2(){
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2024 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>io.helidon.build-tools.dependency.tests</groupId>
<artifactId>parent</artifactId>
<version>@project.version@</version>
<name>Test Dependency 1</name>
<packaging>pom</packaging>

<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>module1</module>
<module>module2</module>
</modules>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>io.helidon.build-tools</groupId>
<artifactId>helidon-dependency-maven-plugin</artifactId>
<version>${project.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Loading

0 comments on commit fc67715

Please sign in to comment.