Skip to content

Commit

Permalink
first viable version
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlermitage committed Jul 7, 2019
1 parent dd4de56 commit 91125ab
Show file tree
Hide file tree
Showing 22 changed files with 58,263 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -18,3 +18,6 @@ insert_final_newline = true
# Markdown files sometimes need trailing whitespaces.
[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
3 changes: 3 additions & 0 deletions .gitattributes
@@ -0,0 +1,3 @@
*.sh text eol=lf
do text eol=lf
mvnw text eol=lf
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -66,3 +66,6 @@ fabric.properties


# End of https://www.gitignore.io/api/intellij+iml

/maven-index-search-suspect-coordinates/.idea/
/maven-index-search-suspect-coordinates/target/
20 changes: 20 additions & 0 deletions .travis.yml
@@ -0,0 +1,20 @@
jdk:
- openjdk8
# - openjdk11

language: java

before_install:
- chmod +x mvnw
- rm -rf $HOME/.m2/repository/biz/lermitage/

script:
- "./mvnw clean install -DskipTests"
- "./mvnw --show-version --errors --batch-mode verify"

cache:
directories:
- $HOME/.m2

git:
depth: 3
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,8 @@
## Old GroupIds Alerter - Change Log

### TODO, ideas, ideal for contribution
* improve tests.
* make plugin configurable.

### 1.0.0 (2019/07/06)
* the main goal `check` works.
21 changes: 21 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017-3192 Jonathan Lermitage

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions README.md
@@ -0,0 +1,61 @@
<h1 align="center">
Old GroupIds Alerter - Maven Plugin
</h1>

<p align="center">
<a href="https://travis-ci.org/jonathanlermitage/oga-maven-plugin"><img src="https://travis-ci.org/jonathanlermitage/oga-maven-plugin.svg?branch=master"/></a>
<a href="https://github.com/jonathanlermitage/oga-maven-plugin/blob/master/LICENSE.txt"><img src="https://img.shields.io/github/license/jonathanlermitage/oga-maven-plugin.svg"/></a>
</p>

A Maven plugin that checks for deprecated *groupId + artifactId* couples, in order to reduce usage of non-maintained 3rd-party code (e.g. did you know that artifact `graphql-spring-boot-starter` moved from `from com.graphql-java` to `com.graphql-java-kickstart`?).

Works with Maven 3.3+ and JDK8+.

## Author

Jonathan Lermitage (<jonathan.lermitage@gmail.com>)
Linkedin profile: [jonathan-lermitage-092711142](https://www.linkedin.com/in/jonathan-lermitage-092711142/)

## Usage

### Goal

There's one maven goal: `biz.lermitage.oga:oga-maven-plugin:check`.

Execution will produce error message everytime a deprecated *groupId + artifactId* couple is found.
You may see something like `[ERROR] 'com.graphql-java:graphql-spring-boot-starter' should be replaced by 'com.graphql-java-kickstart:graphql-spring-boot-starter'`, and Maven build failure.

### Maven coordinates

Maven coordinates (**Maven plugin is not on Apache Central yet!**):

```xml
<groupId>biz.lermitage.oga</groupId>
<artifactId>oga-maven-plugin</artifactId>
<version>1.0.0</version>
```

## Build

Just call `./mvnw clean install` or `./do i` to build plugin and install into local Maven repository.

## Contribution

### Code

Open an issue or a pull-request. Contributions must be tested at least on JDK7 and 8.
Please reformat new code only: do not reformat the whole project or entire existing file (in other words, try do limit the amount of changes in order to speed up code review).

### Definitions file

The list of deprecated *groupId + artifactId* couples is stored in [og-definitions.json](uc/og-definitions.json) file. To remove/update/add entries, you can open an issue, submit a merge request, or simply send an email (<jonathan.lermitage@gmail.com>).

### Find new entries for definitions file

Go to [maven-index-search-suspect-coordinates](maven-index-search-suspect-coordinates/): this project downloads Maven Central indexes and looks for potential entries, then saves it to a file; i.e. artifactIds that exists for two different groupIds (keep in mind that 90~99% are false-positive).
You can view resulting file here: [suspiciousCoordinates.txt](maven-index-search-suspect-coordinates/suspiciousCoordinates.txt) (warning, it's a ~3 MB file).
A filtered version is available here: [suspiciousCoordinates-filtered.txt](maven-index-search-suspect-coordinates/suspiciousCoordinates-filtered.txt) (~500 KB). In this file, we keep only dependency couples where a groupId is a part of the other groupdId, like `com.graphql-java` and `com.graphql-java-kickstart`.

## License

MIT License. In other words, you can do what you want: this project is entirely OpenSource, Free and Gratis.
10 changes: 5 additions & 5 deletions do
Expand Up @@ -11,10 +11,10 @@ for ((cmd = 1; cmd <= $#; cmd++)) do
echo ""
echo "Helper: (tip: you can chain parameters, e.g.: \"./do w 3.6.0 c t\")"
echo ""
echo "t test"
echo "t test plugin"
echo "b compile"
echo "c clean"
echo "p package"
echo "i install plugin's jar, sources and javadoc in local repository"
echo "w \$V set or upgrade Maven wrapper to version \$V"
echo "cv check plugins and dependencies versions"
echo "uv update plugins and dependencies versions"
Expand All @@ -26,15 +26,15 @@ for ((cmd = 1; cmd <= $#; cmd++)) do
;;

"b")
sh ./mvnw compile -DskipTests -T1
sh ./mvnw compile -DskipTests
;;

"c")
sh ./mvnw clean
;;

"p")
sh ./mvnw package -DskipTests -T1
"i")
sh ./mvnw install -DskipTests
;;

"w")
Expand Down
14 changes: 9 additions & 5 deletions do.cmd
@@ -1,27 +1,28 @@
@echo off

if [%1] == [help] (
echo t test
echo t test plugin
echo b compile
echo c clean
echo p package
echo i install plugin's jar, sources and javadoc in local repository
echo w $V set or upgrade Maven wrapper to version $V
echo cv check plugins and dependencies versions
echo uv update plugins and dependencies versions
echo dt show dependencies tree
echo pub build, sign, then upload to Maven Central
)

if [%1] == [t] (
mvnw clean verify
)
if [%1] == [b] (
mvnw clean compile -DskipTests -T1
mvnw clean compile -DskipTests
)
if [%1] == [c] (
mvnw clean
)
if [%1] == [p] (
mvnw clean package -DskipTests -T1
if [%1] == [i] (
mvnw clean install -DskipTests
)
if [%1] == [w] (
mvn -N io.takari:maven:wrapper -Dmaven=%2
Expand All @@ -35,3 +36,6 @@ if [%1] == [uv] (
if [%1] == [dt] (
mvnw dependency:tree
)
if [%1] == [pub] (
mvn clean verify release:prepare release:perform -U -P publish
)
109 changes: 109 additions & 0 deletions maven-index-search-suspect-coordinates/pom.xml
@@ -0,0 +1,109 @@
<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>biz.lermitage.issc</groupId>
<artifactId>issc</artifactId>
<packaging>jar</packaging>

<version>0.0.1-SNAPSHOT</version>
<name>issc</name>

<properties>
<kotlin.version>1.3.40</kotlin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<dependencies>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
<version>6.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<version>3.3.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.3.3</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
<version>4.2.0</version>
</dependency>

</dependencies>

<build>
<plugins>

<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifest>
<mainClass>issc.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnError>true</failOnError>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

</plugins>
</build>
</project>

0 comments on commit 91125ab

Please sign in to comment.