Skip to content

Commit 9e86f80

Browse files
Update README.md
1 parent d7871e2 commit 9e86f80

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
# scala-suffix
2-
A Maven plugin which fixes Scala jars incompatibility with Java 9+
1+
# scala-suffix Maven Plugin
2+
3+
A Maven plugin which fixes Scala jars incompatibility with Java 9+.
4+
5+
### A bit of context
6+
7+
First of all, you need this plugin only in a corner case situation when:
8+
1. You have Scala dependencies in your project.
9+
2. You use Maven.
10+
3. You use JDK 9 or newer.
11+
4. At least one of your Scala dependencies lacks the `Automatic-Module-Name` property in its `MANIFEST.MF`.
12+
13+
If any of those points is not true, `scala-suffix-maven-plugin` will not help you. But if they are, and you're here, it's possible that it's because you have already been bitten by a problem similar to the following:
14+
15+
You add a dependency to your `pom.xml` which looks somehow like this
16+
```
17+
```
18+
You compile the project and you see this warning:
19+
[WARNING] There are 1 pathException(s). The related dependencies will be ignored.
20+
[WARNING] Dependency: <user home>/.m2/repository/<path to jar>/your-scala-dependency_2.13/2.7.1/your-scala-dependency_2.13-2.7.1.jar
21+
- exception: Unable to derive module descriptor for <user home>/.m2/repository/<path to jar>/your-scala-dependency_2.13/2.7.1/your-scala-dependency_2.13-2.7.1.jar
22+
- cause: your.scala.dependency.2.13: Invalid module name: '2' is not a Java identifier
23+
```
24+
25+
... and then when you run your program, it crashes when it tries to access the given Scala dependency.
26+
Paraphrasing [this answer on Stack Overflow](https://stackoverflow.com/questions/48714633/automatic-module-name-containing-number/48714979#48714979), since Java 9, Java does not recognize suffixes in modules names like `_2.13` as version numbers and treat them as integral parts of modules names. So, when your project tries to use a class from the Scala dependency, it will look for `your.scala.dependency.2.13` instead of just `your.scala.dependency`, it will fail to do it, and it will crash.
27+
28+

0 commit comments

Comments
 (0)