Pante/elementary

[BUG] Repo missing in elementary/README.md

Closed this issue ยท 9 comments

Describe the bug
The README tells me that I have to use https://repo.karuslabs.com/repository/elementary-releases, but the parent pom (com.karuslabs:elementary-project:1.1.2) references annotations-4.9.0-SNAPSHOT which is only available from https://repo.karuslabs.com/repository/chimera-snapshots.

To Reproduce
Will provide reproduction steps on request.

Expected behavior
mvn test with the sources from the https://dzone.com/articles/the-problem-with-annotation-processors article should run tests.
(It fails because is cannot find annotations-4.9.0-SNAPSHOT.jar.)

Note that there is another problem with the article: The links to the files ValidCase.java and InvalidCase.java are broken.

Environment (please complete the following information):

  • Java Version: 17
  • Platform: Gradle 5 (does not matter much I believe).

Additional context
Downloading the sources failed, with this Gradle message:

Execution failed for task ':beangen-processor:DownloadSources'.
> Could not resolve all files for configuration ':beangen-processor:downloadSources_46ce9bab-8af4-4bd4-b96f-be93fa4f8943'.
   > Could not find annotations-4.9.0-SNAPSHOT-sources.jar (com.karuslabs:annotations:4.9.0-SNAPSHOT:20210609.075259-113).
     Searched in the following locations:
         https://repo.karuslabs.com/repository/chimera-snapshots/com/karuslabs/annotations/4.9.0-SNAPSHOT/annotations-4.9.0-20210609.075259-113-sources.jar
Pante commented

I just looked into it and it seems like a misconfigured maven-shade plugin. I'll probably redeploy 1.1.2 something later today with the dependencies shaded.

In hindsight, I should not have linked to the source files on master. However, I don't think it'll be ideal to fix it since it'll have to go through DZone's review process again.

Hm... is DZone's review process a problem? I'd imagine that they'd just look at the changes, if they check anything at all, turning that into a fire-and-forget action on your side. (But then maybe my imagination is too far off reality.)

I do have a working Gradle build though.
I can publish it on Github so you can take a look at it, and if you find it useful, you can link it, so Gradle users have a starting point that they can use for a new annotation processor that uses Elementary.

Pante commented

I wound up removing the annotations dependency and redeploying 1.1.2. Since it contained only annotations that were retained at source, it shouldn't affect much. Depending on the snapshot jar, much less an ancient version was a mistake in hindsight.

Do let me know if any issues still exist.

On another note, submitting the changes to DZone was fair less painful than I originally imagined. It should hopefully clear moderation and be out in a couple of days.

Sure thing! That would be awesome!

Done: https://github.com/toolforger/elementary-demo
Let me know about anything that's not quite right. In particular, I believe that at least some of the files in https://github.com/toolforger/elementary-demo/tree/main/src/test/resources/org/example/testdata are not used.

Pante commented

Thanks for taking the time to create the Gradle demo! I think the project's great for the most part with just a few minor issues.

  • Case isn't required since the original example was referencing the Case annotation in Elementary.
  • SomeTest seems to be empty
  • A doesn't seem to be used

Surface reason to create my own Case annotation:
That allows putting Elementary into the test dependencies.

Deeper reason:
The project is supposed to showcase best practices for defining your own annotation and processing it, so I can't use the original Case from Elementary.
I should probably rename the annotation. Except then it gets confusing for those who come from the DZone article... I have to think a bit how to deal with that.

Pante commented

Perhaps the annotation can be renamed to something else and a note mentioning the change in the readme can be added?
EDIT: I probably wasn't clear enough, but I was referring to the Case annotation in the demo project, not Elementary.

Pante commented

I added a reference to the demo project in both the readme & wiki, thanks for the contribution!

You may want to put a watch on the demo project.
If you link the demo, you'll want to be aware of changes in case it become unsuitable (e.g. if the demo becomes unsuitable, or somebody hijacks my project and I can't unwedge things, or I get senile and start spouting nonsense in the demo).