Skip to content
This repository was archived by the owner on Aug 7, 2019. It is now read-only.

whiskeysierra/archer

🚨 Deprecated

This project has been discontinued in favor of enforcing module boundaries by using Maven Multi-Module projects.

Archer

Archer

Stability: Unsupported Build Status Coverage Status Code Quality Release Maven Central

Archer is a pre-defined set of Architectural Enforcement Rules. The aspect-oriented enforcement of rules is guided by annotations and any violation is reported early at compile time.

Features

  • prevents bad code from compiling
  • lightweight API
  • retroactively applicable
  • independent of package structure

Archer defines several different layers:

Layer/Annotation Description
@Gateway External service client
@Library Shared code between any of the layers
@Logic Business logic
@Model Business or domain model
@Persistence Database access layer
@Queue Asynchronous message queue client
@Resource Web Service/API
@Scheduler Background Job

Access policy diagram

Dependencies

  • Java 8
  • AspectJ compiler

Installation

Add the following dependencies to your project:

<dependency>
  <groupId>io.github.whiskeysierra</groupId>
  <artifactId>archer-annotations</artifactId>
  <version>${archer.version}</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>io.github.whiskeysierra</groupId>
  <artifactId>archer-aspectj</artifactId>
  <version>${archer.version}</version>
  <scope>provided</scope>
</dependency>

And configure the AspectJ compiler accordingly:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.8</version>
  <configuration>
    <aspectLibraries>
      <aspectLibrary>
        <groupId>io.github.whiskeysierra</groupId>
        <artifactId>archer-aspectj</artifactId>
      </aspectLibrary>
    </aspectLibraries>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Usage

Archer requires you to annotate every class with one of the layer annotations:

@Model
public class Person {

}

@Persistence
public class PersonRepository {

}

@Logic
public class PersonService {

}

@Resource
public class PersonResource {

}

Any call between two layers that is not allowed by a rule will result in a compiler error. The same is true if a class is missing an annotation.

Known issues

  • No support for package-level annotations, see here

Getting help

If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.

Getting involved

To contribute, simply make a pull request and add a brief description (1-2 sentences) of your addition or change. For more details check the contribution guidelines.

Credits and references

About

Architectural Enforcement

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •