[Git][java-team/plexus-velocity][upstream] 7 commits: New upstream version 1.3

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Sat Oct 31 17:10:56 GMT 2026



Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / plexus-velocity


Commits:
c0275022 by Emmanuel Bourg at 2026-10-31T17:11:55+01:00
New upstream version 1.3
- - - - -
ea732ff6 by Emmanuel Bourg at 2026-10-31T17:13:48+01:00
New upstream version 2.0
- - - - -
9695ffdf by Emmanuel Bourg at 2026-10-31T17:15:39+01:00
New upstream version 2.1.0
- - - - -
24184ed9 by Emmanuel Bourg at 2026-10-31T17:18:55+01:00
New upstream version 2.2.0
- - - - -
aedd9291 by Emmanuel Bourg at 2026-10-31T17:18:55+01:00
New upstream version 2.2.1
- - - - -
5c5520d4 by Emmanuel Bourg at 2026-10-31T17:20:09+01:00
New upstream version 2.3.0
- - - - -
828591fe by Emmanuel Bourg at 2026-10-31T17:23:04+01:00
New upstream version 2.4.0
- - - - -


20 changed files:

- + .github/dependabot.yml
- + .github/workflows/maven.yml
- + .github/workflows/release-drafter.yml
- + LICENSE
- + README.md
- pom.xml
- − src/main/java/org/codehaus/plexus/velocity/DefaultVelocityComponent.java
- − src/main/java/org/codehaus/plexus/velocity/SiteResourceLoader.java
- src/main/java/org/codehaus/plexus/velocity/VelocityComponent.java
- src/main/java/org/codehaus/plexus/velocity/ContextClassLoaderResourceLoader.java → src/main/java/org/codehaus/plexus/velocity/VelocityComponentConfigurator.java
- + src/main/java/org/codehaus/plexus/velocity/internal/DefaultVelocityComponent.java
- + src/main/java/org/codehaus/plexus/velocity/internal/Nullable.java
- − src/main/resources/META-INF/plexus/components.xml
- + src/site/markdown/index.md
- src/site/site.xml
- − src/site/xdoc/index.xml
- src/test/java/org/codehaus/plexus/velocity/DefaultVelocityComponentTest.java
- + src/test/java/org/codehaus/plexus/velocity/TestVelocityComponentConfigurator.java
- − src/test/log4j.properties
- − src/test/resources/org/codehaus/plexus/velocity/DefaultVelocityComponentTest.xml


Changes:

=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,10 @@
+version: 2
+updates:
+  - package-ecosystem: "maven"
+    directory: "/"
+    schedule:
+      interval: "daily"
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "daily"


=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+name: GitHub CI
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    name: Build it
+    uses: codehaus-plexus/.github/.github/workflows/maven.yml at master
+
+  deploy:
+    name: Deploy
+    needs: build
+    uses: codehaus-plexus/.github/.github/workflows/maven-deploy.yml at master
+    secrets: inherit


=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -0,0 +1,12 @@
+name: Release Drafter
+on:
+  push:
+    branches:
+      - master
+jobs:
+  update_release_draft:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: release-drafter/release-drafter at v7.7.0
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


=====================================
LICENSE
=====================================
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.


=====================================
README.md
=====================================
@@ -0,0 +1,58 @@
+# Plexus Velocity
+
+[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-velocity.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.codehaus.plexus/plexus-velocity)
+[![GitHub CI](https://github.com/codehaus-plexus/plexus-velocity/actions/workflows/maven.yml/badge.svg)](https://github.com/codehaus-plexus/plexus-velocity/actions/workflows/maven.yml)
+[![Reproducible Builds](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/jvm-repo-rebuild/reproducible-central/master/content/org/codehaus/plexus/plexus-velocity/badge.json)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/codehaus/plexus/plexus-velocity/README.md)
+[![License](https://img.shields.io/github/license/codehaus-plexus/plexus-velocity.svg?label=License)](https://www.apache.org/licenses/LICENSE-2.0)
+
+A ready-configured [Apache Velocity](https://velocity.apache.org/) engine as an injectable component, so a
+plugin can render a template without setting up Velocity itself.
+
+## Status
+
+Maintained, quietly. It is a thin wrapper over Velocity; most changes here are Velocity upgrades.
+
+## Using it
+
+```xml
+<dependency>
+  <groupId>org.codehaus.plexus</groupId>
+  <artifactId>plexus-velocity</artifactId>
+  <version>2.3.0</version>
+</dependency>
+```
+
+Check the badge above for the current version.
+
+```java
+ at Inject
+VelocityComponent velocityComponent;
+
+VelocityContext context = new VelocityContext();
+Template template = velocityComponent.getEngine().getTemplate( "path/to/template.vm" );
+StringWriter writer = new StringWriter();
+template.merge( context, writer );
+```
+
+The default configuration is meant to be customised: provide a `VelocityComponentConfigurator`
+implementation and it will be picked up. It is optional. See the
+[Velocity configuration reference](https://velocity.apache.org/engine/2.4.1/configuration.html) for what
+can be set.
+
+## Requirements
+
+Java 8 or later.
+
+## Documentation
+
+- [Project site](https://codehaus-plexus.github.io/plexus-velocity/)
+- [Javadoc](https://javadoc.io/doc/org.codehaus.plexus/plexus-velocity)
+- [Release notes](https://github.com/codehaus-plexus/plexus-velocity/releases)
+
+## Contributing
+
+See [CONTRIBUTING.md](https://github.com/codehaus-plexus/.github/blob/master/CONTRIBUTING.md). In short:
+`mvn verify` builds, and run `mvn spotless:apply` before pushing or CI will fail on formatting.
+
+Please report security vulnerabilities privately — see
+[SECURITY.md](https://github.com/codehaus-plexus/.github/blob/master/SECURITY.md), not a public issue.


=====================================
pom.xml
=====================================
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
 Copyright 2001-2006 Codehaus Foundation.
 
@@ -13,30 +14,32 @@ 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>
-    <artifactId>plexus-components</artifactId>
     <groupId>org.codehaus.plexus</groupId>
-    <version>4.0</version>
+    <artifactId>plexus</artifactId>
+    <version>27</version>
+    <relativePath />
   </parent>
 
   <artifactId>plexus-velocity</artifactId>
-  <version>1.2</version>
+  <version>2.4.0</version>
 
   <name>Plexus Velocity Component</name>
+  <description>A component which provides Apache Velocity templating engine integration</description>
+  <url>https://codehaus-plexus.github.io/plexus-velocity/</url>
 
   <scm>
-    <connection>scm:git:git at github.com:codehaus-plexus/plexus-velocity.git</connection>
-    <developerConnection>scm:git:git at github.com:codehaus-plexus/plexus-velocity.git</developerConnection>
-    <url>http://github.com/codehaus-plexus/plexus-velocity</url>
-    <tag>plexus-velocity-1.2</tag>
+    <connection>scm:git:https://github.com/codehaus-plexus/plexus-velocity.git</connection>
+    <developerConnection>${project.scm.connection}</developerConnection>
+    <tag>plexus-velocity-2.4.0</tag>
+    <url>https://github.com/codehaus-plexus/plexus-velocity</url>
   </scm>
   <issueManagement>
     <system>github</system>
-    <url>http://github.com/codehaus-plexus/plexus-velocity/issues</url>
+    <url>https://github.com/codehaus-plexus/plexus-velocity/issues</url>
   </issueManagement>
   <distributionManagement>
     <site>
@@ -45,38 +48,93 @@ limitations under the License.
     </site>
   </distributionManagement>
 
+  <properties>
+    <slf4jVersion>1.7.36</slf4jVersion>
+    <project.build.outputTimestamp>2026-08-19T14:45:06Z</project.build.outputTimestamp>
+  </properties>
+
   <dependencies>
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <!-- override version to avoid CVE-2025-48924 -->
+      <!-- can be removed when velocity upgrades its commons-lang3 dependency -->
+      <version>3.20.0</version>
     </dependency>
+
     <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-      <version>3.1</version>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity-engine-core</artifactId>
+      <version>2.4.1</version>
     </dependency>
+
+    <!-- Used by Velocity at runtime -->
     <dependency>
-      <groupId>org.apache.velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>1.7</version>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4jVersion}</version>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!-- This is a Sisu Component, DI container should be provided by consumer -->
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-testing</artifactId>
+      <version>2.2.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4jVersion}</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <Automatic-Module-Name>org.codehaus.plexus.velocity</Automatic-Module-Name>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.sisu</groupId>
+        <artifactId>sisu-maven-plugin</artifactId>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-scm-publish-plugin</artifactId>
         <configuration>
-          <content>${project.reporting.outputDirectory}</content><!-- mono-module doesn't require site:stage -->
+          <content>${project.reporting.outputDirectory}</content>
+          <!-- mono-module doesn't require site:stage -->
         </configuration>
         <executions>
           <execution>
             <id>scm-publish</id>
-            <phase>site-deploy</phase><!-- deploy site with maven-scm-publish-plugin -->
+            <!-- deploy site with maven-scm-publish-plugin -->
             <goals>
               <goal>publish-scm</goal>
             </goals>
+            <phase>site-deploy</phase>
           </execution>
         </executions>
       </plugin>


=====================================
src/main/java/org/codehaus/plexus/velocity/DefaultVelocityComponent.java deleted
=====================================
@@ -1,177 +0,0 @@
-package org.codehaus.plexus.velocity;
-
-/*
- * Copyright 2001-2016 Codehaus Foundation.
- *
- * 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.
- */
-
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.log.LogChute;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-/**
- * A simple velocity component implementation.
- * <p/>
- * A typical configuration will look like this:
- * <pre>
- *      <configuration>
- *        <properties>
- *          <property>
- *            <name>resource.loader</name>
- *            <value>classpath</value>
- *          </property>
- *          <property>
- *            <name>classpath.resource.loader.class</name>
- *            <value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value>
- *          </property>
- *        </properties>
- *      </configuration>
- * </pre>
- */
-public class DefaultVelocityComponent
-    extends AbstractLogEnabled
-    implements VelocityComponent, Initializable, LogChute
-{
-    private VelocityEngine engine;
-
-    private Properties properties;
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    public void initialize()
-        throws InitializationException
-    {
-        engine = new VelocityEngine();
-
-        // avoid "unable to find resource 'VM_global_library.vm' in any resource loader."
-        engine.setProperty( RuntimeConstants.VM_LIBRARY, "" );
-
-        engine.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, this );
-
-        if ( properties != null )
-        {
-            for ( Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); )
-            {
-                String key = e.nextElement().toString();
-
-                String value = properties.getProperty( key );
-
-                engine.setProperty( key, value );
-
-                getLogger().debug( "Setting property: " + key + " => '" + value + "'." );
-            }
-        }
-
-        try
-        {
-            engine.init();
-        }
-        catch ( Exception e )
-        {
-            throw new InitializationException( "Cannot start the Velocity engine", e );
-        }
-    }
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    public VelocityEngine getEngine()
-    {
-        return engine;
-    }
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    private RuntimeServices runtimeServices;
-
-    public void init( RuntimeServices runtimeServices )
-    {
-        this.runtimeServices = runtimeServices;
-    }
-
-    public void log(int level, String message)
-    {
-        switch ( level )
-        {
-            case LogChute.WARN_ID:
-                getLogger().warn( message );
-                break;
-            case LogChute.INFO_ID:
-                getLogger().info( message );
-                break;
-            case LogChute.DEBUG_ID:
-            case LogChute.TRACE_ID:
-                getLogger().debug( message );
-                break;
-            case LogChute.ERROR_ID:
-                getLogger().error( message );
-                break;
-            default:
-                getLogger().debug( message );
-                break;
-        }
-    }
-
-    public void log(int level, String message, Throwable t)
-    {
-        switch ( level )
-        {
-            case LogChute.WARN_ID:
-                getLogger().warn( message, t );
-                break;
-            case LogChute.INFO_ID:
-                getLogger().info( message, t );
-                break;
-            case LogChute.DEBUG_ID:
-            case LogChute.TRACE_ID:
-                getLogger().debug( message, t );
-                break;
-            case LogChute.ERROR_ID:
-                getLogger().error( message, t );
-                break;
-            default:
-                getLogger().debug( message, t );
-                break;
-        }
-    }
-
-    public boolean isLevelEnabled( int level )
-    {
-         switch ( level )
-        {
-            case LogChute.WARN_ID:
-                return getLogger().isWarnEnabled();
-            case LogChute.INFO_ID:
-                return getLogger().isInfoEnabled();
-            case LogChute.DEBUG_ID:
-            case LogChute.TRACE_ID:
-                return getLogger().isDebugEnabled();
-            case LogChute.ERROR_ID:
-                return getLogger().isErrorEnabled();
-            default:
-                return getLogger().isDebugEnabled();
-        }
-    }
-}


=====================================
src/main/java/org/codehaus/plexus/velocity/SiteResourceLoader.java deleted
=====================================
@@ -1,91 +0,0 @@
-package org.codehaus.plexus.velocity;
-
-/*
- * Copyright 2001-2016 Codehaus Foundation.
- *
- * 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.
- */
-
-import org.apache.commons.collections.ExtendedProperties;
-import org.apache.velocity.runtime.resource.loader.FileResourceLoader;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-import java.io.InputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-/**
- * Allows you to dynamically add resources that you want to be processed by Velocity. For
- * example if you want to generate a site and pull in some random files to be interpolated
- * by Velocity you can use this resource loader.
- *
- * @author Jason van Zyl
- * @deprecated use {@link FileResourceLoader}
- */
- at Deprecated
-public class SiteResourceLoader
-    extends ResourceLoader
-{
-    private static String resource;
-
-    private static File resourceDir;
-
-    public static void setResource( String staticResource )
-    {
-        resource = staticResource;
-        resourceDir = new File( resource ).getParentFile();
-    }
-
-    public void init( ExtendedProperties p )
-    {
-    }
-
-    public InputStream getResourceStream( String name )
-        throws ResourceNotFoundException
-    {
-        if ( resource != null )
-        {
-            try
-            {
-                File f = new File( resourceDir, name );
-                if ( f.exists() )
-                {
-                    return new FileInputStream( f );
-                }
-                else
-                {
-                    return new FileInputStream( resource );
-                }
-            }
-            catch ( FileNotFoundException e )
-            {
-                throw new ResourceNotFoundException( "Cannot find resource, make sure you set the right resource." );
-            }
-        }
-
-        return null;
-    }
-
-    public boolean isSourceModified( org.apache.velocity.runtime.resource.Resource resource )
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public long getLastModified( org.apache.velocity.runtime.resource.Resource resource )
-    {
-        return 0;
-    }
-}
-


=====================================
src/main/java/org/codehaus/plexus/velocity/VelocityComponent.java
=====================================
@@ -22,9 +22,9 @@ import org.apache.velocity.app.VelocityEngine;
  * The VelocityComponent API to access <a href="http://velocity.apache.org/engine/">Apache Velocity Engine</a>
  * configured through Plexus.
  */
-public interface VelocityComponent
-{
-    public final static String ROLE = VelocityComponent.class.getName();
+public interface VelocityComponent {
+    @Deprecated
+    String ROLE = VelocityComponent.class.getName();
 
     VelocityEngine getEngine();
 }


=====================================
src/main/java/org/codehaus/plexus/velocity/ContextClassLoaderResourceLoader.java → src/main/java/org/codehaus/plexus/velocity/VelocityComponentConfigurator.java
=====================================
@@ -16,65 +16,14 @@ package org.codehaus.plexus.velocity;
  * limitations under the License.
  */
 
-import java.io.InputStream;
-
-import org.apache.velocity.runtime.resource.Resource;
-import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
-import org.apache.velocity.runtime.resource.loader.ResourceLoader;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-import org.apache.commons.collections.ExtendedProperties;
+import java.util.Properties;
 
 /**
+ * The VelocityComponent configuration that may configure {@link java.util.Properties} prior having them used to init
+ * Velocity Engine. This component is optional, is not needed if default are sufficient.
  *
- * @deprecated use {@link ClasspathResourceLoader}
- *
+ * @since TBD
  */
- at Deprecated
-public class ContextClassLoaderResourceLoader
-    extends ResourceLoader
-{
-    public void init( ExtendedProperties configuration)
-    {
-    }
-
-    public synchronized InputStream getResourceStream( String name )
-        throws ResourceNotFoundException
-    {
-        InputStream result = null;
-
-        if (name == null || name.length() == 0)
-        {
-            throw new ResourceNotFoundException ("No template name provided");
-        }
-
-        try
-        {
-            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
-            if ( name.startsWith( "/" ) )
-            {
-                name = name.substring( 1 );
-            }
-
-            result = classLoader.getResourceAsStream( name );
-        }
-        catch( Exception fnfe )
-        {
-            throw new ResourceNotFoundException( fnfe.getMessage() );
-        }
-
-        return result;
-    }
-
-    public boolean isSourceModified(Resource resource)
-    {
-        return false;
-    }
-
-    public long getLastModified(Resource resource)
-    {
-        return 0;
-    }
+public interface VelocityComponentConfigurator {
+    void configure(Properties properties);
 }
-


=====================================
src/main/java/org/codehaus/plexus/velocity/internal/DefaultVelocityComponent.java
=====================================
@@ -0,0 +1,72 @@
+package org.codehaus.plexus.velocity.internal;
+
+/*
+ * Copyright 2001-2016 Codehaus Foundation.
+ *
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.util.Properties;
+
+import org.apache.velocity.app.VelocityEngine;
+import org.codehaus.plexus.velocity.VelocityComponent;
+import org.codehaus.plexus.velocity.VelocityComponentConfigurator;
+
+/**
+ * Default component implementation. The presence of {@link VelocityComponentConfigurator} is optional.
+ */
+ at Singleton
+ at Named
+public class DefaultVelocityComponent implements VelocityComponent {
+    private final VelocityEngine engine;
+
+    @Inject
+    public DefaultVelocityComponent(@Nullable VelocityComponentConfigurator componentConfigurator) {
+        Properties properties = new Properties();
+
+        // fill in defaults
+        properties.setProperty("resource.loaders", "classpath,file");
+        properties.setProperty(
+                "resource.loader.classpath.class",
+                "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+        properties.setProperty(
+                "resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
+        properties.setProperty("resource.loader.file.path", "");
+        properties.setProperty("runtime.log.log_invalid_references", "false");
+        properties.setProperty("resource.manager.log_when_found", "false");
+        properties.setProperty(
+                "event_handler.include.class", "org.apache.velocity.app.event.implement.IncludeRelativePath");
+        properties.setProperty("velocimacro.inline.replace_global", "true");
+        properties.setProperty("parser.space_gobbling", "bc");
+
+        // customize if needed
+        if (componentConfigurator != null) {
+            componentConfigurator.configure(properties);
+        }
+
+        VelocityEngine engine = new VelocityEngine();
+        engine.setProperties(properties);
+        engine.init();
+
+        this.engine = engine;
+    }
+
+    @Override
+    public VelocityEngine getEngine() {
+        return engine;
+    }
+}


=====================================
src/main/java/org/codehaus/plexus/velocity/internal/Nullable.java
=====================================
@@ -0,0 +1,18 @@
+package org.codehaus.plexus.velocity.internal;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Internal <code>Nullable</code> annotation to mark parameters that can be null.
+ * <p>
+ * Guice allow any Nullable annotation, so this one can be used instead of adding a dependency to sisu-inject.
+ * <a href="https://github.com/google/guice/wiki/UseNullable">UseNullable</a>
+ */
+ at Target({ElementType.PARAMETER})
+ at Retention(RetentionPolicy.RUNTIME)
+ at Documented
+ at interface Nullable {}


=====================================
src/main/resources/META-INF/plexus/components.xml deleted
=====================================
@@ -1,52 +0,0 @@
-<component-set>
-  <components>
-    <component>
-      <role>org.codehaus.plexus.velocity.VelocityComponent</role>
-      <role-hint>default</role-hint>
-      <implementation>org.codehaus.plexus.velocity.DefaultVelocityComponent</implementation>
-      <configuration>
-        <properties>
-          <property>
-            <name>resource.loader</name>
-            <value>classpath,file</value>
-          </property>
-          <property>
-            <name>classpath.resource.loader.class</name>
-            <value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value>
-          </property>
-          <property>
-            <name>file.resource.loader.class</name>
-            <value>org.apache.velocity.runtime.resource.loader.FileResourceLoader</value>
-          </property>
-          <property>
-            <name>file.resource.loader.path</name>
-            <!-- This space intended! Actually Velocity expects an empty string but
-                 Plexus/XStream choke on it and skip the remaining configuration.
-                 Luckily, Plexus/XStream trim strings and we achieve the desired effect. -->
-            <value> </value>
-          </property>
-          <property>
-            <name>runtime.log.invalid.references</name>
-            <value>false</value>
-          </property>
-          <property>
-            <name>velocimacro.messages.on</name>
-            <value>false</value>
-          </property>
-          <property>
-            <name>resource.manager.logwhenfound</name>
-            <value>false</value>
-          </property>
-          <property>
-            <name>eventhandler.include.class</name>
-            <value>org.apache.velocity.app.event.implement.IncludeRelativePath</value>
-          </property>
-          <property>
-            <name>velocimacro.permissions.allow.inline.to.replace.global</name>
-            <value>true</value>
-          </property>
-        </properties>
-      </configuration>
-    </component>
-  </components>
-</component-set>


=====================================
src/site/markdown/index.md
=====================================
@@ -0,0 +1,29 @@
+---
+title: Plexus Velocity Component
+author: Olivier Lamy
+---
+
+# Plexus Velocity Component
+
+A component which provides [Apache Velocity](https://velocity.apache.org/) templating engine integration.
+
+## Typical use
+
+A typical use:
+
+```java
+VelocityContext context = new VelocityContext();
+VelocityComponent velocityComponent = lookup( VelocityComponent.class );
+Template template = velocityComponent.getEngine().getTemplate( "path to your template" );
+StringWriter writer = new StringWriter();
+template.merge( context, writer );
+```
+
+## Typical Configuration
+
+Plexus Velocity Component comes with a default configuration: it is expected to be customized to match
+local specific need. This is done by creating `VelocityComponentConfigurator` component implementation.
+Presence of this component is optional.
+
+See [Velocity Configuration](https://velocity.apache.org/engine/2.4.1/configuration.html) reference
+documentation for details on available configurations.


=====================================
src/site/site.xml
=====================================
@@ -1,17 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+<site xmlns="http://maven.apache.org/SITE/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 https://maven.apache.org/xsd/site-2.0.0.xsd">
+
   <body>
     <menu name="Overview">
       <item name="Introduction" href="index.html"/>
-      <item name="JavaDocs" href="apidocs/index.html"/>
+      <item name="Javadoc" href="apidocs/index.html"/>
       <item name="Source Xref" href="xref/index.html"/>
       <!--item name="FAQ" href="faq.html"/-->
     </menu>
 
-    <menu ref="parent"/>
     <menu ref="reports"/>
   </body>
-</project>
+</site>


=====================================
src/site/xdoc/index.xml deleted
=====================================
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-
-<document xmlns="http://maven.apache.org/XDOC/2.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
-  <properties>
-    <title>Plexus Velocity Component</title>
-    <author email="olamy at codehaus.org">Olivier Lamy</author>
-  </properties>
-  <body>
-    <section name="Plexus Velocity Component">
-      <p>A component which provides <a href="http://velocity.apache.org/">Apache Velocity</a> templating engine
-      integration.</p>
-
-      <subsection name="Typical use">
-        <p>A typical use:
-        <source>
-VelocityContext context = new VelocityContext();
-VelocityComponent velocityComponent =  (DefaultVelocityComponent) lookup( VelocityComponent.ROLE );
-Template template = velocityComponent.getEngine().getTemplate( "path to your template" );
-StringWriter writer = new StringWriter();
-template.merge( context, writer );</source>
-        </p>
-      </subsection>
-      <subsection name="Typical Configuration">
-        <p>Plexus Velocity Component comes with a default configuration: it is
-        expected to be customized to match local specific need. This is done by hand writing a
-        <code>META-INF/plexus/components.xml</code> Plexus descriptor.</p>
-        <p>A typical component configuration:
-        <source>
-<![CDATA[    <component>
-      <role>org.codehaus.plexus.velocity.VelocityComponent</role>
-      <implementation>org.codehaus.plexus.velocity.DefaultVelocityComponent</implementation>
-      <configuration>
-        <properties>
-          <property>
-            <name>resource.loader</name>
-            <value>classpath</value>
-          </property>
-          <property>
-            <name>classpath.resource.loader.class</name>
-            <value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value>
-          </property>
-        </properties>
-      </configuration>
-    </component>]]></source>
-        </p>
-        <p>See <a href="http://velocity.apache.org/engine/releases/velocity-1.7/developer-guide.html#Velocity_Configuration_Keys_and_Values">Velocity Configuration Keys and Values</a>
-        reference documentation for details on available configurations.</p>
-      </subsection>
-    </section>
-  </body>
-</document>


=====================================
src/test/java/org/codehaus/plexus/velocity/DefaultVelocityComponentTest.java
=====================================
@@ -16,44 +16,45 @@ package org.codehaus.plexus.velocity;
  * limitations under the License.
  */
 
+import javax.inject.Inject;
+
 import java.io.StringWriter;
 
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
-import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.testing.PlexusTest;
+import org.junit.jupiter.api.Test;
 
-public class DefaultVelocityComponentTest
-    extends PlexusTestCase
-{
-    public void testBasic()
-        throws Exception
-    {
-        DefaultVelocityComponent velocity;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-        VelocityContext context;
+ at PlexusTest
+class DefaultVelocityComponentTest {
 
-        String value;
+    @Inject
+    private VelocityComponent velocity;
 
-        velocity = (DefaultVelocityComponent) lookup( VelocityComponent.ROLE );
+    @Test
+    void basic() {
 
         // test the properties
-        value = (String) velocity.getEngine().getProperty( "hello" );
-
-        assertNotNull( value );
+        String value = (String) velocity.getEngine().getProperty("hello");
 
-        assertEquals( "world", value );
+        assertNotNull(value);
+        assertEquals("world", value);
 
         // test the rendering
-        context = new VelocityContext();
+        VelocityContext context = new VelocityContext();
 
-        context.put( "variable", "Value from context" );
+        context.put("variable", "Value from context");
 
-        Template template = velocity.getEngine().getTemplate("org/codehaus/plexus/velocity/DefaultVelocityComponentTest.vm" );
+        Template template =
+                velocity.getEngine().getTemplate("org/codehaus/plexus/velocity/DefaultVelocityComponentTest.vm");
 
         StringWriter writer = new StringWriter();
 
-        template.merge( context, writer );
+        template.merge(context, writer);
 
-        assertEquals( "Static text -- Value from context -- More static text", writer.toString() );
+        assertEquals("Static text -- Value from context -- More static text", writer.toString());
     }
 }


=====================================
src/test/java/org/codehaus/plexus/velocity/TestVelocityComponentConfigurator.java
=====================================
@@ -0,0 +1,35 @@
+package org.codehaus.plexus.velocity;
+
+/*
+ * Copyright 2001-2016 Codehaus Foundation.
+ *
+ * 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.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.util.Properties;
+
+ at Singleton
+ at Named
+public class TestVelocityComponentConfigurator implements VelocityComponentConfigurator {
+    @Override
+    public void configure(Properties properties) {
+        properties.setProperty("resource.loaders", "classpath");
+        properties.setProperty(
+                "resource.loader.classpath.class",
+                "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+        properties.setProperty("hello", "world");
+    }
+}


=====================================
src/test/log4j.properties deleted
=====================================
@@ -1,10 +0,0 @@
-log4j.rootCategory=DEBUG,testlog
-
-# testlog is set to be a File appender using a PatternLayout.
-log4j.appender.testlog = org.apache.log4j.FileAppender
-log4j.appender.testlog.File = test.log
-log4j.appender.testlog.Append = false
-log4j.appender.testlog.Threshold = DEBUG
-log4j.appender.testlog.layout = org.apache.log4j.PatternLayout
-log4j.appender.testlog.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-


=====================================
src/test/resources/org/codehaus/plexus/velocity/DefaultVelocityComponentTest.xml deleted
=====================================
@@ -1,25 +0,0 @@
-<plexus>
-  <components>
-    <component>
-      <role>org.codehaus.plexus.velocity.VelocityComponent</role>
-      <role-hint>default</role-hint>
-      <implementation>org.codehaus.plexus.velocity.DefaultVelocityComponent</implementation>
-      <configuration>
-        <properties>
-          <property>
-          	<name>resource.loader</name>
-          	<value>classpath</value>
-          </property>
-          <property>
-          	<name>classpath.resource.loader.class</name>
-          	<value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value>
-          </property>
-          <property>
-          	<name>hello</name>
-          	<value>world</value>
-          </property>
-        </properties>
-      </configuration>
-    </component>
-  </components>
-</plexus>



View it on GitLab: https://salsa.debian.org/java-team/plexus-velocity/-/compare/7d30d46ebe13b9c6af817e5e255669e8efbf4465...828591fe902195b8678522d38ae071013f816d6c

-- 
View it on GitLab: https://salsa.debian.org/java-team/plexus-velocity/-/compare/7d30d46ebe13b9c6af817e5e255669e8efbf4465...828591fe902195b8678522d38ae071013f816d6c
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261031/28479052/attachment.htm>


More information about the pkg-java-commits mailing list