Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SingaJUG - Andres Almiray - What I wish I knew ...

SingaJUG - Andres Almiray - What I wish I knew about Maven years ago

Michael Isvy

July 09, 2020
Tweet

More Decks by Michael Isvy

Other Decks in Technology

Transcript

  1. @aalmiray | andresalmiray.com mvn -Dkey=value • Properties may be defined

    • In a <properties> block • By plugins • Property values defined on the command line have precedence
  2. @aalmiray | andresalmiray.com Invoke plugins on the go • Any

    plugin may be applied using the long notation G:A:V:goal, in other words mvn com.github.ekryd.echo-maven-plugin:echo-maven- plugin:1.2.0:echo -Decho.message="Hello World!"
  3. @aalmiray | andresalmiray.com Dependencies • Dependencies defined in a <dependencies>

    block are known as direct dependencies. • Dependencies brought by direct dependencies are known as transitive dependencies. • Maven resolves dependencies by locality
 - direct in the current POM. Last found wins (closest).
 - direct in the parent hierarchy.
 - transitive in the hierarchy based on number of hops to reach it. First found wins.
  4. @aalmiray | andresalmiray.com mvn verify • The Reactor knows how

    to build all requirements. • The install goal should only be used when artifacts must be published to the local repository. • Invoking clean diminishes the reuse of intermediate results -> defeats incremental builds.
  5. @aalmiray | andresalmiray.com Broken Buildtools and Bad Behaviors; The Maven

    Story by Robert Scholte https://www.youtube.com/watch?v=2HyGxtsDf60
  6. @aalmiray | andresalmiray.com Partial Execution • Maven runs multi-project builds

    inside a Reactor. • The Reactor executes goals for all projects. • mvn -pl <paths> executes the given goals for all projects in <paths> • mvn -am -pl <paths> also executes for all prerequisites in the Reactor
  7. @aalmiray | andresalmiray.com Restrictions • All invoked plugin goals must

    exist in every project! • Define common plugins in parent POMs using a combination of <pluginManagement> and <plugins>. • You’d be forced to define dummy values for plugins in some cases.
  8. @aalmiray | andresalmiray.com Aggregating POMs • These POM files define

    a <modules> section. • They are typically also parent POMs but they DO NOT have to be! • Also, values in <module> are paths, not project names.
  9. @aalmiray | andresalmiray.com The preceding is intended to outline our

    general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All information in this presentation is current as of September 2019 and Oracle undertakes no duty to update any statement in light of new information or future events. Safe Harbor Statement