GithubHelp home page GithubHelp logo

takari / polyglot-maven Goto Github PK

View Code? Open in Web Editor NEW
885.0 885.0 98.0 2.59 MB

Support alternative markup for Apache Maven POM files

License: Eclipse Public License 1.0

Java 54.77% Clojure 2.13% Groovy 1.53% Ruby 1.50% Scala 15.11% Kotlin 24.95%

polyglot-maven's People

Contributors

asomov avatar bentmann avatar callmetango avatar cstamas avatar deivid-rodriguez avatar dependabot[bot] avatar dhanji avatar dimiii avatar fbricon avatar headius avatar huntc avatar ifedorenko avatar jdillon avatar jvanzyl avatar laeubi avatar lefou avatar lion7 avatar mkristian avatar monkstone avatar mosabua avatar nilols avatar paulvi avatar petromir avatar ph avatar randgalt avatar rkuhn avatar serhiyverovka avatar sveryovka avatar szantopeter avatar thorntonrp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polyglot-maven's Issues

Make ModelPresenter order list global

as in #75 file, that order affects only YAML, but should be global

     List<String> order = new ArrayList<String>(Arrays.asList(
              "modelVersion",
              "groupId",
              "artifactId",
              "version",
              "packaging",
              "properties",
              "name",
              "description",
              "inceptionYear",
              "url",
              "issueManagement",
              "ciManagement",
              "mailingLists",
              "scm",
              "licenses",
              "developers",
              "contributers",
              "prerequisites",
              "dependencies",
              "distributionManagement",
              "build",
              "reporting"));

And used by all.

Parsers result (POM for Editors Outline)

For Eclipse Editor to have outline, there should be parser to generate a tree structure.
There's of course no sense to make parser for every language, as they should be translated into one POM model.

How to get this output?
It can be command line tool invocation that produces text file.

ref #71

Support for maven-tiles; trying out `<extensions>true</extensions>` and multiple entries inside `<configuration>` by @talios

maven-tiles https://github.com/repaint-io/maven-tiles allows to have parts of build definition in separate files. Having part of build in parts can enable quicker adoption of polyglot thinking,
and skip problem of having to translate parts, e.g. when find an example of plugin configuration.

Possibly this issue should sound like "support translating parts of pom"

ref repaint-io/maven-tiles#61

[polyglot-groovy] translation of activation > activeByDefault > false generates invalid groovy

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>foo.bar</groupId>
  <artifactId>java</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <profiles>
    <profile>
      <id>badly-translated</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
    </profile>
  </profiles>
</project>

converted to pom.groovy yields

project {
  modelVersion '4.0.0'
  groupId 'foo.bar'
  artifactId 'java'
  version '0.0.1-SNAPSHOT'
  profiles {
    profile {
      id 'badly-translated'
      activation
    }
  }
}

which is bad groovy: No such property: activation for class: org.sonatype.maven.polyglot.groovy.builder.ModelBuilder$1

because activeByDefault=false is the default value, it's not rendered, leading to an empty but illegal activation node.

This comes from a real world example https://github.com/jboss-developer/jboss-eap-quickstarts/blob/7.0.x-develop/kitchensink-html5-mobile/pom.xml#L282 (or org.wildfly.archetype:wildfly-html5-mobile-archetype:8.2.0.Final)

Tools support

@fbricon It may be easy to add some editors (e.g. for atom, yaml), but will m2e see this?
Can pom.xml files be generated for use with existing tools?

resolving relativePath on parent

when there is simple setup like
.
├── pom.scala
├── ruby-maven
│   └── pom.rb
└── ruby-maven-libs
└── pom.gy

then when generating the parent attribute the relative path needs to be set, using the ModelLocator (i.e.PolyglotModelManager) to do so. at least ruby does not do it and since the default is '../pom.xml' the reactor fails.

[polyglot-yaml] does not handle shade plugin

this valid xml shade configuration:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.2</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>Xxxx</mainClass>
                            </transformer>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                                <resource>
                                    .groovy
                                </resource>
                            </transformer>
                        </transformers>
                        <artifactSet>
                            <excludes>
                                <exclude>META-INF/*.groovy</exclude>
                            </excludes>
                        </artifactSet>
                    </configuration>
                </execution>
            </executions>
        </plugin>

is translated into:

- artifactId: maven-shade-plugin
    executions:
   - configuration:
         transformers:
         transformer: {resource: .groovy}
        artifactSet:
        excludes: {exclude: META-INF/*.groovy}
        goals: [shade]
        id: default
       inherited: true
       phase: package
       priority: 0
extensions: false
groupId: org.apache.maven.plugins
inherited: true
version: 2.4.2

which fails to compile.

FileNotFoundException: translate.conf (No such file or directory)

I've tried last binary version and can't run "translate" task:

vbauer@vladislav-bauer:~/workspace/java/simba$ /home/vbauer/Applications/tesla-polyglot/bin/translate pom.xml pom.yaml
java.io.FileNotFoundException: /home/vbauer/Applications/apache-maven/bin/translate.conf (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:390)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
vbauer@vladislav-bauer:~/workspace/java/simba$ cd ~/Applications/tesla-polyglot/bin/
vbauer@vladislav-bauer:~/Applications/tesla-polyglot/bin$ ls -la
total 72
drwxrwxrwx 2 vbauer vbauer 4096 Jan 20 08:27 .
drwxrwxrwx 7 vbauer vbauer 4096 Jan 20 08:27 ..
-rw-r--r-- 1 vbauer vbauer  478 Jan 20 08:27 m2.conf
-rwxr-xr-x 1 vbauer vbauer 5807 Jan 20 08:27 mvn
-rwxrwxrwx 1 vbauer vbauer 6150 Sep 30 21:57 mvn.bat
-rwxr-xr-x 1 vbauer vbauer 5955 Jan 20 08:27 mvnDebug
-rwxrwxrwx 1 vbauer vbauer 6304 Sep 30 21:57 mvnDebug.bat
-rwxr-xr-x 1 vbauer vbauer 6114 Jan 20 08:27 mvnyjp
-rwxr-xr-x 1 vbauer vbauer 4382 Jan 20 08:27 translate
-rwxrwxrwx 1 vbauer vbauer 6009 Jan 20 08:27 translate.bat
-rw-r--r-- 1 vbauer vbauer  418 Jan 20 08:27 translate.conf

The same problem happens when I run translate task in directory "maven-polyglot/bin"

vbauer@vladislav-bauer:~/Applications/tesla-polyglot/bin$ ./translate ~/workspace/java/simba/pom.xml pom.yaml
java.io.FileNotFoundException: /home/vbauer/Applications/apache-maven/bin/translate.conf (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:390)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

"translate.conf" is placed in another place, not "/home/vbauer/Applications/apache-maven/bin/translate.conf", but "/home/vbauer/Applications/tesla-polyglot/bin/translate.conf"

Optional dependencies causing issues

If the pom.xml contains an optional dependency

<dependency>
  <groupId>some.thing</groupId>
  <artifactId>some-thing</artifactId>
  <optional>true</optional>
</dependency>

Ruby translation will fail with the following stack trace

java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.List
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.dependencies(RubyModelWriter.java:632)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.project(RubyModelWriter.java:216)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.print(RubyModelWriter.java:76)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter.write(RubyModelWriter.java:64)
    at org.sonatype.maven.polyglot.io.ModelWriterSupport.write(ModelWriterSupport.java:50)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:116)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:99)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:83)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.translate(PolyglotTranslatorCli.java:74)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.translate(PolyglotTranslatorCli.java:67)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.run(PolyglotTranslatorCli.java:58)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.main(PolyglotTranslatorCli.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Translate plugin fails when current path contains spaces

On Windows, translate plugin fails if the full path to the working directory contains spaces.

Example path: D:\Documents\x y\test

Failed to execute goal io.takari.polyglot:polyglot-translate-plugin:0.1.12:translate (default-cli) on project test: Error translating pom.xml -> pom.yaml: D:\Documents\x%20y\test\pom.yaml (The system cannot find the path specified) -> [Help 1]

Cannot write repositores section in Ruby

I tried to translate from XML to Ruby, but i got this stacktrace:

java.lang.NullPointerException
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.printRepositoryPolicy(RubyModelWriter.java:171)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.printRepositories(RubyModelWriter.java:162)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.repositories(RubyModelWriter.java:83)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.project(RubyModelWriter.java:206)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter$ModelPrinter.print(RubyModelWriter.java:76)
    at org.sonatype.maven.polyglot.ruby.RubyModelWriter.write(RubyModelWriter.java:64)
    at org.sonatype.maven.polyglot.io.ModelWriterSupport.write(ModelWriterSupport.java:50)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:116)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:99)
    at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:83)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.translate(PolyglotTranslatorCli.java:74)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.translate(PolyglotTranslatorCli.java:67)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.run(PolyglotTranslatorCli.java:58)
    at org.sonatype.maven.polyglot.cli.PolyglotTranslatorCli.main(PolyglotTranslatorCli.java:84)

This is the relevant section in my pom.xml:

<repositories>
    <repository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

The problem is that the writer tries to print snapshot and release policy even if it is not defined in the source pom.

What is "atom"?

I see a lot of common languages in the list of extensions here, with the exception of "atom". What is it? The syntax is unfamiliar, and the extension looks like it's self-contained.

Add an extension point in Maven's core for Polyglot POM parsing

We don't want to require including all libraries for parsing all types of POMs in the distribution. Ideally we want to provide an extension point that will allow Maven to dynamically download what is required to deal with the Polyglot flavour that is present in the users project.

Scala DSL: How to use the antrun plugin?

To configure the antrun plugin in Scala DSL, I tried this:

       Plugin(
         gav = "org.apache.maven.plugins" % "maven-antrun-plugin" % "1.7",
         executions = Seq(
           Execution(id = "copy-runner-env", phase = "package", goals = Seq("run"),
             configuration = Config(
               target = """
                 <mkdir dir="${basedir}/target/runner/lib" />
                 <copy file="${basedir}/target/${project.build.finalName}.jar"
                   toFile="${basedir}/target/runner/lib/${project.artifactId}.jar" />
                 <copy toDir="${basedir}/target/runner">
                   <fileset dir="src/runner/resources" />
                 </copy>
                """
             )
           )
         )
       )

Unfortunately, this doesn't work. See the error message below:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (copy-runner-env) on project test: An Ant BuildException has occured: Unexpected text "<"
[ERROR] around Ant part ...&lt;mkdir dir=&quot;/tmp/test/target/runner/lib&quot; /&gt;... @ 4:21 in /tmp/test/target/antrun/build-main.xml
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

As an alternative one could avoid the antrun plugin by using the Task API, but unfortunately, I can't add additional dependencies to it, to use thirdparty libs (like https://github.com/lihaoyi/Ammonite) for the copy operation. See #32.

Maven "-f" does not recognize "pom.yml" in subdirectory

If Maven is given the "-f" option to execute within a subdirectory, it won't find the POM if it is using one of Polyglot's other filename extensions like "yml" in "pom.yml":

$ mvn -f foo compile
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /home/user/test/foo/pom.xml: /home/user/test/foo/pom.xml (No such file or directory) @

However, "foo/pom.yml" does exist, so it would be expected that "mvn -f foo" would work. If a "foo/pom.xml" file is created, then "mvn -f foo" works.

A workaround is to say "mvn -f foo/pom.yml" which does work with a "foo/pom.yml" file, but it would be nice to not have to know the POM type in the command.

.tesla.xxx.pom issues

As of commit bfc16c7, the creation of a .tesla.xxx.pom poses some new issues:

  • developers will be expected to have their scm ignore .tesla* files;
  • the encoding of a model to xml consumes more time vs using an xml directly; and most importantly
  • the encoded .tesla.xxx.pom must conform to any restrictions imposed on the pom it was produced from.

I'm particularly concerned about the restriction conformance. For example on the tesla modules, the poms must have license headers. Generated poms do have such headers of course.

The approach of generating a .tesla.xxx.pom is concerning. According to commit bfc16c7 it is because the install plugin requires a pom.xml to deploy. Perhaps there's another way to approach this e.g. have a translate occur as part of the install plugin and reference the updated install plugin as part of the tesla build. The pom.xxx file should also be installed alongside any pom.xml. This approach would also require pom.xxx files to have a higher priority than pom.xml (which I think is a good thing anyhow).

How to can I start with it?

Hello, developers!

This projects is 'breath of fresh air for me' because I worked with Ruby some time and I like it very much. You need small adopt time and Ruby is like an good habit.

I have installed Ruby (for windows with devkit), JDK and Maven, I have done some small self-education projects in maven way. Currently I want to start with Maven RubyDSL configuration of pom.xml. How to can I do it? Standard Ruby distrubutive is enough or I need JRuby?

Can I translate current pom.xml files to .rb? I read the article http://takari.io/2015/01/28/ruby-dsl.html. It's excellent but how to start?

Translate to pom.xml mishandled XML entity

Neat - I can run the translator in reverse to generate pom.xml from pom.yml.

However roundtrip failed for an XML entity, in this creating extra entries for MANIFEST.MF:

Source pom.xml contains

<Built-By>B. K. Oxley (binkley) &lt;[email protected]&gt;</Built-By>

Generated pom.yml contains:

Built-By: B. K. Oxley (binkley) [email protected]>

Roundtrip translate back to XML contains (note the > near the end of the line):

<Built-By>B. K. Oxley (binkley) &lt;[email protected]></Built-By>

So interestingly the LT entity was translated back, but the GT entity was not, producing invalid XML.

Provide a goal to generate pom.xml

If we could execute for example:

mvn io.takari.polyglot:polyglot-maven-plugin:generateXml

then projects using polyglot could be opened by any IDE supporting Maven. Of course it's just a walk-around, but it's still better than nothing.

XML use attribute replace sub element

Do you have any plan to improve the xml schema and use attribute to replace sub element ? in this way many config can be write in one line just like spring did。

    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>

can be wirten in:

    <dependency  groupId="aopalliance" artifactId="aopalliance" version="1.0" />

attribute name can be make shoter

[polyglot-groovy] Add support for dependency scope blocks

I think it'd be nice to add support for dependency scope blocks/closures like:

project {
  modelVersion '4.0.0'
  groupId 'foo.bar'
  artifactId 'example'
  version '0.0.1-SNAPSHOT'
  dependencies {
    test {
          'junit:junit:4.12'
          'org.mockito:mockito-core:1.10.19'
    }
    provided {
        'foo:bar:x.y.z'
    }
    // also support other scopes
  }
}

[polyglot-groovy] conversion to pom.groovy should generate dependencies w/ short syntax

Converting this pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>foo.bar</groupId>
    <artifactId>example</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

to groovy yields this:

project {
  modelVersion '4.0.0'
  groupId 'foo.bar'
  artifactId 'example'
  version '0.0.1-SNAPSHOT'
  dependencies {
    dependency {
      groupId 'junit'
      artifactId 'junit'
      version '4.12'
      scope 'test'
    }
  }
}

It'd be great to get an even less verbose output, like:

project {
  modelVersion '4.0.0'
  groupId 'foo.bar'
  artifactId 'example'
  version '0.0.1-SNAPSHOT'
  dependencies {
    dependency 'junit:junit:4.12:test'
  }
}

as this syntax is already supported

[polyglot-groovy] Reinstate unit test execution

Unit tests are not executed during Maven builds of polyglot-groovy.

They can run from Eclipse though (after installing the m2e-groovy connector). However, 3 tests (GroovyModelWriterTest#testWriting, GroovyModelReaderTest#testExecute, GroovyModelReaderTest#testReading) fail with CNFE like

java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
    at org.sonatype.maven.polyglot.groovy.GroovyModelTestSupport.load(GroovyModelTestSupport.groovy:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:143)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
    at org.sonatype.maven.polyglot.groovy.GroovyModelWriterTest.testWriting(GroovyModelWriterTest.groovy:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.typehandling.ShortTypeHandling
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 30 more

Adding the following snippet to polyglot-groovy/pom.xml can reinstate compilation and execution of unit tests, yielding the same errors:

    <properties>
        <groovy.compiler.version>2.9.2-01</groovy.compiler.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>${groovy.compiler.version}</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version><!--$NO-MVN-MAN-VER$ -->
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>${groovy.compiler.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.4.3-01</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

The code compile against groovy 1.7.3. That missing org.codehaus.groovy.runtime.typehandling.ShortTypeHandling is supposed to happen when mixing bits from old groovy versions and groovy 2.3.5+ (See http://glaforge.appspot.com/article/groovy-2-3-5-out-with-upward-compatibility). Adding the compatibility jar to the classpath (or plugin classpath) didn't fix anything.

But ideally, the groovy dependency should be bumped to the latest release (2.4.4), but then you get into more issues.

  testBuildParseGoals1(org.sonatype.maven.polyglot.groovy.builder.ModelBuilderTest): No such property: _SCRIPT_CLASS_NAME_ for class: org.apache.maven.model.Model
  testBuildParseGoals2(org.sonatype.maven.polyglot.groovy.builder.ModelBuilderTest): No such property: _SCRIPT_CLASS_NAME_ for class: org.apache.maven.model.Model
  testBuildWithConfiguration(org.sonatype.maven.polyglot.groovy.builder.ModelBuilderTest): No such property: _SCRIPT_CLASS_NAME_ for class: org.apache.maven.model.Model
  testExecute(org.sonatype.maven.polyglot.groovy.GroovyModelReaderTest): Cannot set property '_SCRIPT_CLASS_NAME_' on null object
  testReading(org.sonatype.maven.polyglot.groovy.GroovyModelReaderTest): Cannot set property '_SCRIPT_CLASS_NAME_' on null object

I don't know enough about groovy to be able to fix the issue myself, so if anyone could help, or give me some directions, that'd be much appreciated. @jdillon or @Randgalt, any ideas?

Java DSL

Do you have any plans to add Java DSL as an alternative language for pom?

Multi-module project doesn't work when parent isn't in repo

NOTE: I've only tried this with groovy

I have a standard multi module project ala:

src
pom.groovy
module1
             src
             pom.groovy
module2
            src
            pom.groovy

Performing "mvn compile" from the root produces: "[FATAL] Non-resolvable parent POM for..."

However, if I then do: "mvn -N install" from the root and then do "mvn compile" it works fine.

NullPointerException in polyglot-translate-plugin (pom.scala)

A simple Maven project pom created from the archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 cannot be translated.

The pom.xml looks like:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>g</groupId>
  <artifactId>a</artifactId>
  <version>1</version>
  <packaging>jar</packaging>

  <name>a</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

And the exception is:

$ mvn io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate -Dinput=pom.xml -Doutput=pom.scala -X
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: /usr/share/maven-bin-3.3
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /opt/oracle-jdk-bin-1.8.0.45/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "3.18.11-gentoo", arch: "amd64", family: "unix"
...
[DEBUG] Configuring mojo io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate from plugin realm ClassRealm[plugin>io.takari.polyglot:polyglot-translate-plugin:0.1.9, parent: sun.misc.Launcher$AppClassLoader@4e25154f]
[DEBUG] Configuring mojo 'io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate' with basic configurator -->
[DEBUG]   (f) input = /tmp/exec/a/pom.xml
[DEBUG]   (f) output = /tmp/exec/a/pom.scala
[DEBUG] -- end configuration --
[INFO] Translating /tmp/exec/a/pom.xml -> /tmp/exec/a/pom.scala
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.931 s
[INFO] Finished at: 2015-06-17T21:06:46+02:00
[INFO] Final Memory: 9M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate (default-cli) on project a: Execution default-cli of goal io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate (default-cli) on project a: Execution default-cli of goal io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal io.takari.polyglot:polyglot-translate-plugin:0.1.9:translate failed.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.lang.NullPointerException
        at org.kiama.output.PrettyPrinter$$anonfun$text$1.apply(PrettyPrinter.scala:1004)
        at org.kiama.output.PrettyPrinter$$anonfun$text$1.apply(PrettyPrinter.scala:1003)
        at org.kiama.output.PrettyPrinter$Doc.apply(PrettyPrinter.scala:978)
        at org.kiama.output.PrettyPrinter$Doc$$anonfun$$less$greater$1$$anonfun$apply$31$$anonfun$apply$32.apply(PrettyPrinter.scala:988)
        at org.kiama.output.PrettyPrinter$Doc$$anonfun$$less$greater$1$$anonfun$apply$31$$anonfun$apply$32.apply(PrettyPrinter.scala:986)
        at org.kiama.util.Trampolines$Trampoline$$anonfun$resume$1.apply(Trampolines.scala:59)
        at org.kiama.util.Trampolines$Trampoline$$anonfun$resume$1.apply(Trampolines.scala:59)
        at org.kiama.util.Trampolines$Trampoline.runT(Trampolines.scala:47)
        at org.kiama.output.PrettyPrinter$class.pretty(PrettyPrinter.scala:1112)
        at org.sonatype.maven.polyglot.scala.ScalaPrettyPrinter$.pretty(ScalaModelWriter.scala:23)
        at org.sonatype.maven.polyglot.scala.ScalaModelWriter.write(ScalaModelWriter.scala:296)
        at org.sonatype.maven.polyglot.io.ModelWriterSupport.write(ModelWriterSupport.java:47)
        at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:116)
        at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:99)
        at org.sonatype.maven.polyglot.TeslaModelTranslator.translate(TeslaModelTranslator.java:83)
        at io.takari.maven.polyglot.TranslatorMojo.translate(TranslatorMojo.java:54)
        at io.takari.maven.polyglot.TranslatorMojo.translate(TranslatorMojo.java:50)
        at io.takari.maven.polyglot.TranslatorMojo.execute(TranslatorMojo.java:43)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more

Scala DSL and cross building

Hi,
I went over #22 and I wasn't sure if the Scala DSL is being cross built for 2.10/2.11
I think it's a really important requirement of most Scala users as it signals that the library will support them when a new version will come out (as well as for those not who haven't moved yet to 2.11)
Did I read it wrong?

dependencies section inside build->plugins throws ClassCastException

Using the following pom.yml section we get a ClassCastException if we try to use dependencies inside of a plugin.

profiles:
      build:
        plugins:
            - groupId: org.apache.maven.plugins
              artifactId: maven-site-plugin
              version: 3.4
              dependencies:
                - {artifactId: wagon-webdav-jackrabbit, groupId: org.apache.maven.wagon, optional: false,
        type: jar, version: '2.9'}
[ERROR] Internal error: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency
        at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writePlugin(MavenXpp3Writer.java:1402)
        at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writeBuildBase(MavenXpp3Writer.java:400)
        at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writeProfile(MavenXpp3Writer.java:1583)
        at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writeModel(MavenXpp3Writer.java:1131)
        at org.apache.maven.model.io.xpp3.MavenXpp3Writer.write(MavenXpp3Writer.java:100)
        at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:106)
        at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:83)
        at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:529)
        at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:269)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
        at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
        at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
        at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
        at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        ... 11 more

polyglot-yaml does not handle nested lists

GIven this pom.yml:


---
artifactId: raudondvaris
groupId: dmos
modelVersion: 4.0.0
packaging: war
prerequisites: {maven: 3.3.3}
version: 1.0
build:
  outputDirectory: ${project.build.directory}/${project.build.finalName}/WEB-INF/classes
  plugins:
    - artifactId: proguard-maven-plugin
      groupId: com.github.wvengen
      version: 2.0.11
      configuration:
        libs:
          - ${java.home}/lib/rt.jar
          - ${java.home}/lib/jsse.jar

proguard-maven-plugin throws following exception:

Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo com.github.wvengen:proguard-maven-plugin:2.0.11:proguard for parameter libs: Cannot assign configuration entry 'libs' with value '[/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar, /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar]' of type java.lang.String to property of type java.util.List.

Running mvn proguard:proguard -X (-X added), reveals how the <configuration> tree is passed to proguard:

<configuration>
  ...
  <libs>[/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar, /usr/lib/jvm/java-7-o
penjdk-amd64/jre/lib/jsse.jar]</libs>
  ...
</configuration>

Apparently the libs list was collapsed into a one line version, but then was not translated to xml. Instead it was passed as a string, hence the exception.

io.takari.polyglot/polyglot-yaml is version 0.1.11, which is the latest version.

Way to reproduce:

Put above pom.yml sample into a pom-test.yml, and run:

mvn io.takari.polyglot:polyglot-translate-plugin:translate -Dinput=pom-test.yml -Doutput=pom-test.xml

In the produced .xml build.plugins.configuration.libs is deformed.

JavaScript

Please add JavaScript option, see

jjs in Java 8 nashorn allows to execute Java code from JavaScript without build.
That makes Java+JavaScript similar to Groovy.

var jsArray = [1,2,3,4];
var list = java.util.Arrays.asList(jsArray);
list.forEach(function(el) { print(el) } ); 

More

var r = new java.lang.Runnable({
    run: function() {
        print("running...\n");
    }
});

[polyglot-groovy] translation of empty element (relativePath) generates invalid groovy

This one is kinda similar to bug #57 : translating a pom generated by the spring starter service (http://start.spring.io/starter.zip?name=demo&groupId=com.example&artifactId=demo&version=0.0.1-SNAPSHOT&description=Demo+project+for+Spring+Boot&packageName=com.example&type=maven-project&packaging=jar&javaVersion=1.8&language=java&bootVersion=1.3.0.RELEASE) to groovy results in an invalid pom.groovy.

The culprit is the empty relativePath node in the parent section. Simplest pom to reproduce the issue:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.maven.polyglot.test</groupId>
    <artifactId>app</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
</project>

Having an empty relativePath seems dubious to me in the 1st place. Maybe some kind of optimization? (@martinlippert any idea?)

Still, ideally, the translator should be able to produce valid groovy.

This problem was originally reported by @dsayer in jbosstools/m2e-polyglot-poc#3

Build failure over Ruby tests (build unstable?); badge for https://ci.takari.io jobs

  test_pom_from_jarfile_with_repos(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemspec_with_source(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemfile_with_extras(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemfile_with_groups(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_pom_from_jarfile(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemfile_with_source(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemfile_with_platforms(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_pom_from_jarfile_help_only(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemspec_in_profile(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemspec_with_jar_dependencies(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_gemfile_include_jars(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22
  test_pom_from_jarfile_and_skip_lock(org.sonatype.maven.polyglot.ruby.RubyReaderWithPomTest): Unknown character property name {o} near index 22

Tests run: 79, Failures: 0, Errors: 76, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Polyglot :: Aggregator ............................. SUCCESS [  0.272 s]
[INFO] Polyglot :: Common ................................. SUCCESS [  0.949 s]
[INFO] Polyglot :: Atom ................................... SUCCESS [  2.437 s]
[INFO] Polyglot :: Clojure ................................ SUCCESS [  4.180 s]
[INFO] Polyglot :: Groovy ................................. SUCCESS [  5.085 s]
[INFO] Polyglot :: Maven Plugin ........................... SUCCESS [  1.294 s]
[INFO] Polyglot :: Ruby ................................... FAILURE [05:35 min]
[INFO] Polyglot :: Scala .................................. SKIPPED
[INFO] Polyglot :: YAML ................................... SKIPPED
[INFO] Polyglot :: XML .................................... SKIPPED
[INFO] Polyglot :: Translate Plugin ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:51 min
[INFO] Finished at: 2016-04-15T21:53:04+08:00
[INFO] Final Memory: 76M/567M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project polyglot-ruby: There are test failures.
[ERROR]

Dumped "pom.xml" takes precedence over "pom.yml"

If using "pom.yml" as the authoritative source while dumping it out with "polyglot.dump.pom=pom.xml" into "pom.xml" for compatibility with other tools that understand only the XML version in "pom.xml", then on the next Maven invocation the previously dumped "pom.xml" will be read, while "pom.yml" is ignored. This means changes in "pom.yml" are no longer picked up by Maven and neither is a new version of "pom.xml" dumped from it. Is this the intended behavior? If not, would it please be possible to have "pom.yml" (and other Polyglot variants) take precedence over "pom.xml"? Tested with Polyglot for Maven 0.1.12.

It is neither possible use another name than "pom.xml" as a workaround, because the other tools expect the file to be found using that exact name.

Plugin dependencies result in a ClassCastException (polyglot-yaml)

Hi,

First of all I would like to thank for your effort and this project. I have been playing with the extension for some time and I really like it so far!

I have just found a bug with the handling of the plugin dependencies. I am using the latest version of polyglot-yaml at the time of writing - 0.1.9. Whenever I add some plugin dependencies to my pom.yml I get the following exception:

[ERROR] Internal error: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassCastException: org.codehaus.plexus.util.xml.Xpp3Dom cannot be cast to org.apache.maven.model.Dependency
    at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writePlugin(MavenXpp3Writer.java:1402)
    at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writeBuild(MavenXpp3Writer.java:329)
    at org.apache.maven.model.io.xpp3.MavenXpp3Writer.writeModel(MavenXpp3Writer.java:1115)
    at org.apache.maven.model.io.xpp3.MavenXpp3Writer.write(MavenXpp3Writer.java:100)
    at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:109)
    at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:86)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:529)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:269)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
    at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
    at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    ... 11 more

Please find below my pom.yml file and the original corresponding pom.xml files.

pom.yml

modelVersion: 4.0.0
groupId: org.marchev
artifactId: groovy-playground
name: groovy-playground project
version: 1.0-SNAPSHOT

dependencies:
  - { groupId: junit, artifactId: junit, version: 4.12, scope: test }
  - { groupId: org.codehaus.groovy, artifactId: groovy-all, version: 2.4.3 }

build:
  plugins:
    - groupId: org.codehaus.groovy
      artifactId: groovy-eclipse-compiler
      version: 2.9.2-01
      extensions: true
    - artifactId: maven-compiler-plugin
      version: 3.3
      configuration:
        compilerId: groovy-eclipse-compiler
        source: 1.8
        target: 1.8
      dependencies:
        - groupId: org.codehaus.groovy
          artifactId: groovy-eclipse-compiler
          version: 2.9.2-01
        - groupId: org.codehaus.groovy
          artifactId: groovy-eclipse-batch
          version: 2.4.3-01

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.marchev</groupId>
    <artifactId>groovy-playground</artifactId>
    <name>groovy-playground project</name>
    <version>1.0-SNAPSHOT</version>


    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.3</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.2-01</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>2.9.2-01</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.4.3-01</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

polyglot-maven project Scope and Goal

What is project Scope and Goal?

I see as it should not try to change model, but maybe very little #52 (scope)

and the goal should be expose POM model to be to operate over.

Description not string escaped

When translating a pom with a description, it is not properly escaped. For instance:

project 'all' do
  ...
  description 'All of Square's Java projects. It's like a party for your code.'
  ...
end

The ' should be prefixed by .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.