Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #11 from CJSCommonPlatform/minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
jaceko committed Jun 13, 2016
2 parents 6b5934e + cf2683e commit 1efe08f
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 8 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Change Log
All notable changes to this project will be documented in this file, which follows the guidelines
on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to
[Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Minor fixes to log messages

## [1.1.1] - 2016-05-12

### Added

- RAML and JSON schema validation mojo for syntax checking without generation
- Add source paths to generator configuration
- Add an option to look for RAML files in the classpath, allowing generation to be done on Maven dependencies not just local files

### Changed

- Skip directory cleaning before generation

## [1.1.0] - 2016-04-18

### Added

- Support for passing custom properties to plugin configuration

## [1.0.0] - 2016-03-15

### Added

- Initial release with basic code generation support
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# raml-jaxrs
# RAML Maven Plugin
[![Build Status](https://travis-ci.org/CJSCommonPlatform/raml-maven.svg?branch=master)](https://travis-ci.org/CJSCommonPlatform/raml-maven)
[![Coverage Status](https://coveralls.io/repos/github/CJSCommonPlatform/raml-maven/badge.svg?branch=master)](https://coveralls.io/github/CJSCommonPlatform/raml-maven?branch=master)

RAML to JAXR generator
This project contains a plugin for using [RAML](http://raml.org/) documents within Maven projects.
Currently, it has two purposes:

- _Code generation_ - the plugin can be configured with arbitrary code generation modules to generate custom code from RAML documents
- _RAML syntax checking_ - for validating the syntax of RAML documents and imported JSON schemas

## Usage

For example, to generate code using a generator class `ExampleGenerator` using RAML from an external
Maven dependency:

```xml
<build>
<plugins>
<plugin>
<artifactId>raml-maven-plugin</artifactId>
<groupId>uk.gov.justice.maven</groupId>
<version>1.1.1</version>
<executions>
<execution>
<configuration>
<generatorName>
uk.gov.justice.raml.maven.test.ExampleGenerator
</generatorName>
<basePackageName>uk.gov.justice.api</basePackageName>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<sourceDirectory>CLASSPATH</sourceDirectory>
<includes>
<include>**/*external-*.raml</include>
</includes>
<excludes>
<exclude>**/*external-ignore.raml</exclude>
</excludes>
</configuration>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>uk.gov.justice.maven</groupId>
<artifactId>raml-for-testing-io</artifactId>
<version>${project.version}</version>
<classifier>raml</classifier>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
```
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.justice</groupId>
<artifactId>parent-pom</artifactId>
<version>1.6.10-SNAPSHOT</version>
<version>1.6.10</version>
</parent>

<groupId>uk.gov.justice.maven</groupId>
Expand All @@ -28,7 +28,7 @@
<dependency>
<groupId>uk.gov.justice</groupId>
<artifactId>common-bom</artifactId>
<version>1.6.10-SNAPSHOT</version>
<version>1.6.10</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
5 changes: 3 additions & 2 deletions raml-maven-plugin-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -93,7 +94,7 @@
<dependency>
<groupId>uk.gov.justice</groupId>
<artifactId>common-bom</artifactId>
<version>1.6.6-SNAPSHOT</version>
<version>1.6.10</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -118,4 +119,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.gov.justice.raml.maven.validator;

import static java.io.File.pathSeparator;

import uk.gov.justice.raml.io.FileTreeScannerFactory;
import uk.gov.justice.raml.maven.common.BasicGoalConfig;
import uk.gov.justice.raml.maven.common.BasicMojo;
Expand Down Expand Up @@ -29,13 +31,13 @@ public void execute() throws MojoExecutionException, MojoFailureException {

private void report(final Map<Path, ValidationResult> results) throws MojoFailureException {
if (results.isEmpty()) {
getLog().info("Raml and Json Schema Validation Complete");
getLog().info("RAML and JSON schema validation complete");
} else {
String validationResultsPrint = printResults(results, sourceDirectory);

getLog().debug(validationResultsPrint);

throw new MojoFailureException(results, "Raml & Json schema validation has failed", validationResultsPrint);
throw new MojoFailureException(results, "RAML and JSON schema validation failed", validationResultsPrint);
}
}

Expand All @@ -59,6 +61,7 @@ private String printResults(final Map<Path, ValidationResult> results, final Fil
.forEach(resultEntry -> {
sb.append("\nSyntax check has failed for ");
sb.append(sourceDirectory);
sb.append(pathSeparator);
sb.append(resultEntry.getKey());
sb.append("\nError Level : ");
sb.append(resultEntry.getValue().getLevel());
Expand Down

0 comments on commit 1efe08f

Please sign in to comment.