SlideShare a Scribd company logo
Apache Maven supports ALL Java
ROBERT SCHOLTE @RFSCHOLTE
The good news
Apache Maven runs fine on JDK 9 ( and 10 )
Apache Maven works like heaven on JDK 11 ( and 12-ea )
Possible issues are often plugin related
Upgrading to the latest version should solve the problem
Applying a module descriptor
1. Just add your module-info.java to src/main/java
2. Upgrade maven-compiler-plugin to at least 3.8.0
3. There’s no step three
Maven will calculate which dependencies belong to the classpath and which to the module path.
No new dependency-element/scope
When two worlds collide…
Maven
Java
<= 8
Maven
Java
<= 8
Java 9+
Goals Java Platform Modular System
Reliable configuration
Strong encapsulation
The module-info.java
module com.foo.module.name
{
// reliable configuration
requires some.other.module;
// strong encapsulation
exports com.foo.package.name;
}
If you’re not careful with your modularization
you can corrupt the whole Maven Ecosystem
Library builders should be aware of the impact of their module descriptors
Application builders should recognize these issues
Revised specifications
• Jars on modulepath
• Support ALL-MODULE-PATH
• Modulenames with numbers
• Automatic module names
Jars on modulepath
Original spec only allowed directories
Maven dependencies point to a file
Directory may contain multiple jars (javadoc,sources)
ALL-MODULE-PATH
--add-modules ALL-MODULE-PATH
In short: Make all entries on the module path see each other
Module names
Déjà Vu
What is the proper module name?
What is the proper groupId and artifactId?
Modulenames with numbers
Project/product names
• AWS-EC2
• AWS-Route53
• AWS-S3
• C3P0
• DB2
• Fabric8
• H2
• JSRnnn
• OAuth2
Versioned libraries (includes
versioned packages)
• Commons-lang2
• Commons-lang3
Bridge libraries to different
versions
• Jspc-compiler-tomcatN
• Mockwire-springN
• Surefire-junitN
Close to 30.000 groupId/artifactId end with a number (Central, March 2017)
Original implementation did not allow module names ending with a number.
#VersionsInModuleNames
Some have argued that library maintainers will
be tempted to encode major version numbers,
or even full version numbers, in module names.
Is there some way we can guide people away
from doing that?
Resolution Abandon the previous proposal to
mandate that module names appearing in
source-form module declarations must both
start and end with “Java letters”. Revise the
automatic-module naming algorithm to allow
digits at the end of module names.
Module names must be
as unique as the coordinates of dependencies
Automatic module names
“… . The module name is otherwise derived from the name of the JAR file.”
NPM Javascript package
registry
Over 13500 ‘rows’ of collisions
Evidence (OCT 2016)
JIGSAW
Automatic modules are required for top-
down adoption
MAVEN
References to automatic module names
will cause collisions sooner or later
Library builders should never refer to automatic modules* and deploy to a public repository.
Application builders can choose to refer to automatic modules.
* Filename based
Application versus library
Application
Module descriptor without exports
maven-compiler-plugin logs info message in
case of automatic module usage
Library
Module descriptor with exports
Tip: Use Maven 3.5.0+ for colour support
maven-compiler-plugin logs
WARNING message in case of
automatic module usage
Automatic modules
Ease of top-down migration for application builders
But what about “in the middle” library builders?
Java Platform. It will be approachable, i.e., easy to learn and
easy to use, so that developers can use it to construct and
maintain libraries and large applications for both the Java SE
and Java EE Platforms.
JSR 376: JavaTM Platform Module System
Original Java Specification Request (JSR)
Section 2.1
Application my-app
Libraries jackson-core jackson-databind jackson-annotations my-lib
java.base
Conference example
Application my-app
Libraries (direct deps) … … … my-lib
Libraries (transitive deps)
…
… … …
Libraries (independent deps) jackson-core jackson-databind jackson-annotations
java.base
More realworld example
1currency-1.0.jar
2buy-service-1.0.jar
module org.moneylibs.buy
{
requires currency;
}
3currence-2.0.jar
module org.moneylibs.currency
{
}
4sell-service-1.0.jar
module org.moneylibs.sell
{
requires org.moneylibs.currency;
}
5animalmarket-1.0.jar
module com.animalmarket
{
requires org.moneylibs.buy;
requires org.moneylibs.sell;
}
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.animalmarket</groupId>
<artifactId>animalmarket</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<!-- the dependencies -->
</dependencies>
</project>
<dependency>
<groupId>org.moneylibs</groupId>
<artifactId>buy-service</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.moneylibs</groupId>
<artifactId>sell-service</artifactId>
<version>1.0</version>
</dependency>
animalmarket.jar
(com.animalmarket)
requires o.m.buy;
requires o.m.sell;
buy-service-1.0.jar (o.m.buy)
requires currency;
sell-service-1.0.jar (o.m.sell)
requires o.m.currency;
animalmarket.jar
(com.animalmarket)
requires org.moneylibs.buy;
requires org.moneylibs.sell;
buy-service-1.0.jar (o.m.buy)
requires currency;
currency-1.0.jar
(currency)
sell-service-1.0.jar (o.m.sell)
requires org.moneylibs.currency;
currency-2.0.jar
(o.m.currency)
animalmarket.jar
(com.animalmarket)
requires o.m.buy;
requires o.m.sell;
buy-service-1.0.jar (o.m.buy)
requires currency;
currency-1.0.jar
(currency)
sell-service-1.0.jar (o.m.sell)
requires o.ms.currency;
currency-2.0.jar
(o.m.currency)
<dependency>
<groupId>org.moneylibs</groupId>
<artifactId>buy-service</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.moneylibs</groupId>
<artifactId>sell-service</artifactId>
<version>1.0</version>
</dependency>
animalmarket.jar
(com.animalmarket)
requires o.m.buy;
requires o.m.sell;
sell-service-1.0.jar (o.m.sell)
requires o.m.currency;
currency-2.0.jar
(o.m.currency)
buy-service-1.0.jar (o.m.buy)
requires currency;
currency-1.0.jar
(currency)
animalmarket.jar
(com.animalmarket)
requires o.m.buy;
requires o.m.sell;
sell-service-1.0.jar (o.m.sell)
requires o.m.currency;
currency-2.0.jar
(o.m.currency)
buy-service-1.0.jar (o.m.buy)
requires currency;
currency-1.0.jar
(currency)
Migrate
META-INF/MANIFEST.MF
•Automatic-Module-Name
2buy-service-1.0.jar
META-INF/MANIFEST.MF
Automatic-Module-Name:
org.moneylibs.buy
Point of
no return
“If you refer to
dependency X:N as a
module and dependency
X:N-1 has no module
name, then you cannot
downgrade this
dependency anymore”
currency-1.0.jar
(currency)
sell-service-1.0.jar
(o.m.sell)
requires o.m.currency;
currency-2.0.jar
(o.m.currency)
Strong advices
-Project must be Java 9 ready!!
o No split packages
o No root classes
-For libraries that depends on at least one filename based automodule:
o Help depending projects by providing intended module name via MANIFEST
-Pick your modulename with care, e.g. the shared package
Mistakes will happen
In fact, first invalid modules are already available at Maven Central
asm-6.0_BETA ( org.ow2.asm)
asm-all-6.0_BETA (org.ow2.asm.all) 1
asm-debug-all-6.0_BETA (org.ow2.asm.debug.all) 1
Application developer cannot fix these mistakes (dependency-exclude doesn’t work)
1 Fixed with asm-6.0 by dropping *-all artifacts (asm includes debug information by
default)
Same packages must
have the same
modulename
(otherwise potential
split package issue)
Tips for using JAVA 9 with MAVEN
DON’T change your folder structure (no need for extra folder with module
name)
Modulepath or classpath? No change to dependencies, just add module-
info.java ( Plexus-java can help plugins to build up the path )
Understanding plexus-java
Maven independent library for general Java features
◦ LocationManager
◦ Version
Used by
◦ maven-compiler-plugin
◦ maven-failsafe-plugin
◦ maven-javadoc-plugin
◦ maven-jlink-plugin
◦ maven-jmod-plugin
◦ maven-surefire-plugin
◦ …
Plexus Java :: LocationManager
If there’s a module descriptor, all its direct and indirect required modules will be put on the
module path, the rest on the classpath
Most plugins show the paths as debug logging ( -X / --debug )
Learn the JPMS specifications
JLINK
“You can use the jlink tool to assemble and optimize a set of modules and their dependencies
into a custom runtime image”
Enhanced solution for fat executable jar
However… it is overrated
Only works with explicit modules!
Source / target 1.9
<release>9<release>
source/target <= 1.8 : animal-sniffer
Issues?
1) Stackoverflow
2) Apache Maven mailinglists
3) Apache Maven Jira in case of bugs / improvements
Frequently Asked Questions
Can every project become modular?
NO
-Java 9 is a gamechanger, it introduces new rules
-The older the project, the more likely it cannot follow these rules
-No worries, the classpath is still there and will stay!
The boomerang question
Or “the ever returning Maven/JavaNEXT/Conference question”
Will Maven generate the module descriptor?
No
Different purpose
◦Pom is used to download jars and make them available
◦Module descriptor is used to specify required modules
Not all modules are dependencies
◦( e.g. java.logging, jdk.compiler )
Module descriptor elements not covered:
◦Module name
◦Open module
◦Exported packages
◦Uses / provides services
Pom 4.0.0 has no space for new elements
Pom hygiene
dependency:analyse
◦ Analyzes the dependencies of this project and determines which are:
◦used and declared (good)
◦used and undeclared (via transitive dependency)
◦unused and declared (ballast!)
Dependencies can be excluded,
required modules cannot
…BUT JDEPS can do it, right?
Can create a rough module descriptor
Intended to help with an initial descriptor
Uses binary classes, i.e. AFTER compile-phase
Some open source project will…
https://github.com/moditect/moditect
[RESULT] Apache Maven supports ALL Java
Up-for-grabs
~60-80% of Java Project/Developers use Maven
The Apache Maven Project holds ~95 (sub)projects
Maintained by ~5-10 active volunteers (No Company!)
Let’s restore the balance!
https://s.apache.org/up-for-grabs_maven
https://maven.apache.org/guides/development/guide-committer-school.html
Thank you
@ASFMAVENPROJECT

More Related Content

What's hot (20)

PDF
OpenJDK-Zulu talk at JEEConf'14
Ivan Krylov
 
PDF
Hands On with Maven
Sid Anand
 
ODP
Java and XPages
Patrick Kwinten
 
PPTX
Developing Agile Java Applications using Spring tools
Sathish Chittibabu
 
PDF
Java 7 Modularity: a View from the Gallery
njbartlett
 
PDF
Maven, Eclipse and OSGi Working Together - Carlos Sanchez
mfrancis
 
PDF
Java Programming - 01 intro to java
Danairat Thanabodithammachari
 
PPTX
Preparing for java 9 modules upload
Ryan Cuprak
 
PDF
Tuscany : Applying OSGi After The Fact
Luciano Resende
 
PPTX
Maven
Chris Roeder
 
PPTX
Maven
feng lee
 
PDF
Java EE 7 - Into the Cloud
Markus Eisele
 
PPSX
Maven Presentation - SureFire vs FailSafe
Holasz Kati
 
PDF
Java EE 6 and GlassFish v3: Paving the path for future
Arun Gupta
 
PDF
Head toward Java 14 and Java 15 #LINE_DM
Yuji Kubota
 
PPTX
Managed Beans: When, Why and How
Russell Maher
 
PPTX
Node.js Development with Apache NetBeans
Ryan Cuprak
 
ODP
An Introduction to Maven Part 1
MD Sayem Ahmed
 
PPT
Maven 2 features
Angel Ruiz
 
PPTX
An Introduction to Maven
Vadym Lotar
 
OpenJDK-Zulu talk at JEEConf'14
Ivan Krylov
 
Hands On with Maven
Sid Anand
 
Java and XPages
Patrick Kwinten
 
Developing Agile Java Applications using Spring tools
Sathish Chittibabu
 
Java 7 Modularity: a View from the Gallery
njbartlett
 
Maven, Eclipse and OSGi Working Together - Carlos Sanchez
mfrancis
 
Java Programming - 01 intro to java
Danairat Thanabodithammachari
 
Preparing for java 9 modules upload
Ryan Cuprak
 
Tuscany : Applying OSGi After The Fact
Luciano Resende
 
Maven
feng lee
 
Java EE 7 - Into the Cloud
Markus Eisele
 
Maven Presentation - SureFire vs FailSafe
Holasz Kati
 
Java EE 6 and GlassFish v3: Paving the path for future
Arun Gupta
 
Head toward Java 14 and Java 15 #LINE_DM
Yuji Kubota
 
Managed Beans: When, Why and How
Russell Maher
 
Node.js Development with Apache NetBeans
Ryan Cuprak
 
An Introduction to Maven Part 1
MD Sayem Ahmed
 
Maven 2 features
Angel Ruiz
 
An Introduction to Maven
Vadym Lotar
 

Similar to Apache Maven supports all Java (JokerConf 2018) (20)

PPTX
Apache maven and its impact on java 9 (Java One 2017)
Robert Scholte
 
PPTX
The do's and don'ts with java 9 (Devoxx 2017)
Robert Scholte
 
PPTX
Apache Maven and Java 9 and 10 (Devoxx France 2018)
Robert Scholte
 
PPSX
Java 9 and the impact on Maven Projects (JavaOne 2016)
Robert Scholte
 
PPSX
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Robert Scholte
 
PPTX
Modern Java Workshop
Simon Ritter
 
PPT
Java 9 Module System
Hasan Ünal
 
PDF
Exploring Maven SVN GIT
People Strategists
 
PDF
Java 9 / Jigsaw - AJUG/VJUG session
Mani Sarkar
 
PDF
Note - Apache Maven Intro
boyw165
 
PPTX
Leaner microservices with Java 10
Arto Santala
 
PDF
Java, Eclipse, Maven & JSF tutorial
Raghavan Mohan
 
PPSX
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
PPTX
Migrating to Java 11
Arto Santala
 
PDF
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
PDF
Java 8 Overview
Nicola Pedot
 
PPT
Maven Introduction
Sandeep Chawla
 
PPTX
Riga Dev Day - Automated Android Continuous Integration
Nicolas Fränkel
 
PDF
JavaOne 2016: Life after Modularity
DanHeidinga
 
Apache maven and its impact on java 9 (Java One 2017)
Robert Scholte
 
The do's and don'ts with java 9 (Devoxx 2017)
Robert Scholte
 
Apache Maven and Java 9 and 10 (Devoxx France 2018)
Robert Scholte
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Robert Scholte
 
Java 9 and the impact on Maven Projects (ApacheCon Europe 2016)
Robert Scholte
 
Modern Java Workshop
Simon Ritter
 
Java 9 Module System
Hasan Ünal
 
Exploring Maven SVN GIT
People Strategists
 
Java 9 / Jigsaw - AJUG/VJUG session
Mani Sarkar
 
Note - Apache Maven Intro
boyw165
 
Leaner microservices with Java 10
Arto Santala
 
Java, Eclipse, Maven & JSF tutorial
Raghavan Mohan
 
Java9 and the impact on Maven Projects (JFall 2016)
Robert Scholte
 
Migrating to Java 11
Arto Santala
 
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
Java 8 Overview
Nicola Pedot
 
Maven Introduction
Sandeep Chawla
 
Riga Dev Day - Automated Android Continuous Integration
Nicolas Fränkel
 
JavaOne 2016: Life after Modularity
DanHeidinga
 
Ad

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
July Patch Tuesday
Ivanti
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Ad

Apache Maven supports all Java (JokerConf 2018)