ProductPromotion
Logo

Java

made by https://0x3d.site

GitHub - takari/polyglot-maven: Support alternative markup for Apache Maven POM files
Support alternative markup for Apache Maven POM files - takari/polyglot-maven
Visit Site

GitHub - takari/polyglot-maven: Support alternative markup for Apache Maven POM files

GitHub - takari/polyglot-maven: Support alternative markup for Apache Maven POM files

Overview

Polyglot for Maven is a set of extensions for Maven 3.3.1+ that allows the POM model to be written in dialects other than XML. Several of the dialects also allow inlined plugins: the Ruby, Groovy and Scala dialects allow this.

License

Maven Central

Takari Slack

Here's an example POM written in the Ruby dialect:

project 'Polyglot :: Aggregator' do

  model_version '4.0.0'
  id 'io.tesla.polyglot:tesla-polyglot:0.0.1-SNAPSHOT'
  inherit 'io.tesla:tesla:4'
  packaging 'pom'

  properties( 'sisuInjectVersion' => '0.0.0.M2a',
              'teslaVersion' => '3.1.0' )

  modules [ 'tesla-polyglot-common',
            'tesla-polyglot-atom',
            'tesla-polyglot-ruby',
            'tesla-polyglot-groovy',
            'tesla-polyglot-yaml',
            'tesla-polyglot-clojure',
            'tesla-polyglot-scala',
            'tesla-polyglot-java',
            'tesla-polyglot-xml',
            'tesla-polyglot-cli',
            'tesla-polyglot-maven-plugin' ]

  overrides do
    jar 'org.eclipse.sisu:org.eclipse.sisu.inject:${sisuInjectVersion}'
    jar 'org.eclipse.sisu:org.eclipse.sisu.plexus:${sisuInjectVersion}'
    jar 'org.apache.maven:maven-model-builder:3.1.0'
    jar 'org.apache.maven:maven-embedder:3.1.0'
    jar( 'junit:junit:4.11', :scope => 'test' )

  end

  plugin 'org.codehaus.plexus:plexus-component-metadata:1.5.4' do
    execute_goals 'generate-metadata', 'generate-test-metadata'
  end

  build do
    execute("first", :validate) do |context|
      puts "Hello from JRuby!"
    end
  end
end

Requirements

Usage

To use Polyglot for Maven you need to edit ${maven.multiModuleProjectDirectory}/.mvn/extensions.xml and add the appropriate language extension.

The scala dialect supports a separate configuration parameter polyglot.scala.outputdir to specify a different output directory. This avoids the deletion during a Maven clean phase run, when set to a different folder such as .polyglot-cache instead of the default target. Inspect polyglot-maven-examples/scala/.mvn/maven.config for an example setup.

Available Languages

The available languages, in alphabetical order, with their artifact id are:

Language Artifact Id
Atom polyglot-atom
Groovy polyglot-groovy
Clojure polyglot-clojure
Kotlin polyglot-kotlin
Ruby polyglot-ruby
Scala polyglot-scala
YAML polyglot-yaml
Java polyglot-java
XML polyglot-xml

The groupId value is io.takari.polyglot.

Update extensions.xml

Edit the extensions.xml file and add the following, replacing ARTIFACTID with the artifactId for your chosen language.

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
  <extension>
    <groupId>io.takari.polyglot</groupId>
    <artifactId>ARTIFACTID</artifactId>
    <version>0.4.6</version>
  </extension>
</extensions>

Convert existing POM

We have created a simple Maven plugin that will help you convert any existing pom.xml files:

mvn io.takari.polyglot:polyglot-translate-plugin:translate \
  -Dinput=pom.xml -Doutput=pom.{format}

Where the supported formats are rb, groovy, scala, yaml, atom, java and of course xml. See here for more info. You can even convert back to xml or cross-convert between all supported formats.

Known Limitations and Issues

Interoperability

The whole interoperability story has not been worked out but you can create a XML-formatted POM from the Polyglot version. Currently mixing different dialects within a reactor is not supported.

A pom.xml will currently not be installed or deployed except for the Ruby DSL and the Scala DSL but we are working towards this feature for all DSLs.

Tooling

Some support in IDE's like IntelliJ IDEA and Eclipse exist and the different markup languages are understood by various syntax highlighters. However, full integration of the markup syntax and the specific Maven-related aspects is not available.

Limited Plugin Support

Maven plugins or Maven plugin goals that rely on the XML format are not supported, since they are either attempting to parse the XML directly or modify it in automated fashion do not work with Polyglot Maven. Examples are:

  • Maven Release Plugin
  • Maven Versions Plugin (goals that don't edit the pom.xml (like e.g. display-dependency-updates) work as expected though)

Fixes would have to be implemented in these plugins. Workarounds or replacement workflows for most usecases exist.

Polyglot Maven in Real Life

Despite the warning above, Polyglot Maven is pretty stable right now. Have a look at the integration tests for each dialect in this repository for some examples as well as our dedicated polyglot-maven-examples project.

Some dialect folder contain specific README files with futher instructions as as test code with example projects and more. Ensure to check the ones for your specific dialect out as well.

The following projects are real world usage examples that use Polyglot Maven in their regular development and release work:

Kotlin

Specific docs and more can be found in the Kotlin dialect specific readme.

Ruby

YAML

Scala

Specific docs and more can be found in the Scala dialect specific readme.

Java Projects

  • LambdaTest - A simple Java project with a standalone pom.scala

  • CmdOption (until version 0.6.0 ) - A Java project with a top-level reactor project and an additional shared scala file included into both pom.scalas (Switched over to Mill after version 0.6.0)

Scala Projects

  • Domino (until version 1.1.3) - A simple project using Polyglot Scala. (Switched over to Mill after version 1.1.3)

  • Blended (until version 2.4.0.2) - A complex multi-project using Polyglot Scala. Now archived. It's also an example where the #include feature is heavily used to share common configuration but avoid Maven parent poms, which are often problematic. (Switched later to sbt and then Mill)

Please let us know of your usage by filing an issue so we can add it here.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory