Skip to content
Merged
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
54 changes: 39 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2001-2006 Codehaus Foundation.

Expand All @@ -13,15 +14,13 @@ 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>10.0</version>
<relativePath />
<artifactId>plexus-components</artifactId>
<version>14.2</version>
</parent>

<artifactId>plexus-velocity</artifactId>
Expand All @@ -32,8 +31,8 @@ limitations under the License.
<scm>
<connection>scm:git:[email protected]:codehaus-plexus/plexus-velocity.git</connection>
<developerConnection>scm:git:[email protected]:codehaus-plexus/plexus-velocity.git</developerConnection>
<url>http://github.com/codehaus-plexus/plexus-velocity</url>
<tag>HEAD</tag>
<url>http://github.com/codehaus-plexus/plexus-velocity</url>
</scm>
<issueManagement>
<system>github</system>
Expand All @@ -52,15 +51,34 @@ limitations under the License.
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
</dependency>

<!-- Used by Velocity at runtime -->
<dependency>
<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.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>0.9.0.M2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand All @@ -69,33 +87,39 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4jVersion}</version>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>6.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* The VelocityComponent API to access <a href="http://velocity.apache.org/engine/">Apache Velocity Engine</a>
* configured through Plexus.
*/
public interface VelocityComponent
{
public interface VelocityComponent {
@Deprecated
String ROLE = VelocityComponent.class.getName();

VelocityEngine getEngine();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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.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.
*
* @since TBD
*/
public interface VelocityComponentConfigurator {
void configure(Properties properties);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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;
import org.eclipse.sisu.Nullable;

/**
* Default component implementation. The presence of {@link VelocityComponentConfigurator} is optional.
*/
@Singleton
@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;
}
}
52 changes: 0 additions & 52 deletions src/main/resources/META-INF/plexus/components.xml

This file was deleted.

Loading