Skip to content

Commit

Permalink
Added explanation of how to use the maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisric authored Dec 4, 2024
1 parent 7a38717 commit b957feb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ Astra has been developed and tested at Alfa to improve the velocity at which lar
* Astra can be run as part of a Java application, using `astra-core` as a dependency and using the refactors it provides. For an illustration of how to do this, please see the [README in astra-core](./astra-core/README.md). The code can be found in [astra-example](./astra-example).
* For cases needing a more bespoke approach, [astra-core](./astra-core/README.md) also provides an SPI for writing your own custom `ASTOperation`s. See the `astra-core` README for further details.
* For very simple cases, there is also a command line interface which exposes a small subset of Astra's refactoring operations. Please see [astra-cli](./astra-cli/README.md) for more information.
* Astra can also be run as a plugin during your build e.g. `mvn org.alfasoftware:astra-maven-plugin:2.4.2:refactor -Dastra.usecase=org.my.MyUseCase` though this requires `MyUseCase` to be available on your classpath. Therefore it is often better to amend your pom so that Astra can be used when needed and the UseCase can be retrieved from a separate library e.g.

```
<build>
<plugins>
<plugin>
<groupId>org.alfasoftware</groupId>
<artifactId>astra-maven-plugin</artifactId>
<version>2.4.2</version>
<dependencies>
<dependency>
<groupId>org.yourcompany</groupId>
<artifactId>usecase-library</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
```
Then, as the plugin and version is defined, you can simply invoke `mvn astra:refactor -Dastra.usecase=org.my.MyUseCase`

## Why would I use Astra?
A simple and common use case is renaming a method, and updating all the callers of that method so that they use the new name.
Expand Down

0 comments on commit b957feb

Please sign in to comment.