#646 Mavenization

None
open
nobody
None
2015-09-11
2013-04-12
No

I use Marauroa in Maven environments so I ended up needing to mavenize Marauroa. Is just adding one file to the source. Project can then be built both via Maven or via Ant.

It would be great if you guys published on Maven repositories. Everything is already set up, just needs someone to follow instructions here: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide and update the pom file. I can help you guys with that.

Related

Developers: #274

Discussion

  • Mavenization

     
    Attachments
  • I did some fixed to the pom.xml files, updated the tests to work with an in-memory database.

    I deleted the pom.xml again for now (see history for the latest version) becase there are still some issues:

    • The UTF-8 support tests fail:
      - testWithUTF8(marauroa.common.io.UnicodeSupportingInputStreamReaderTest)
      - testWithUTF8WithBOM(marauroa.common.io.UnicodeSupportingInputStreamReaderTest)
    • "mvn install" downloads a large number of apparently unrelated libraries
    • There is a lib/junit-4.4.jar which the bundled hamcrest-core. "mvn install" puts a new junit.jar (unbundled) and hamcrest-core.jar next to it
    • "mvn install" creates a lib/license folder and puts some license files there. We should unify that with the license files manually placed in lib (either systems is okay from my point of view, but we should only have one)
     
    • The test works fine on my end. Le tme know if you have more questions.

       
  • 1) The UTF-8 might be just a missing POM configuration.
    2) This is a side effect of using Maven.
    3) Need more details on this one.
    4) The licenses used are the official ones for the downloaded jars. It can be configured.

    Once you clarify I'll take a look.

     
  • Can you point me to your changes so I can checkout? Got here way too late I guess. The emails was buried since I was out on vacation.

     
  • Balaur
    Balaur
    2015-09-08

    I wanted to try it, but I got this:

    [ERROR] Failed to execute goal on project marauroa: Could not resolve dependencies for project net.sourceforge.arianne.marauroa:marauroa:jar:3.9.4-SNAPSHOT: Could not find artifact javax.jnlp:jnlp:jar:5.0 in netbeans (http://bits.netbeans.org/maven2/) -> [Help 1]

     
  • Hmm. It might be due to the Java version. Which one are you compiling on?

    <dependency>
    <groupId>javax.jnlp</groupId>
    <artifactId>jnlp-api</artifactId>
    <version>5.0</version>
    <scope>system</scope>
    <systemPath>${java.home}/lib/javaws.jar</systemPath>
    </dependency>

    Make sure that the file exists in that location. It might differ with the version of JDK.

     
  • If java.home points to a JRE, the path is correct, but if java.home points to a JDK, the path is ${java.home}/jre/lib/javaws.jar.

     
    Last edit: Hendrik Brummermann 2015-09-08
  • Balaur
    Balaur
    2015-09-09

    I'm on OpenJDK 8, and I can't find javaws.jar anywhere.

     
  • Balaur
    Balaur
    2015-09-09

    • summary: Mevenization --> Mavenization
    • Group: -->
     
  • Which OS are you using?

    On linux run this command:

    update-alternatives --display javaws

    I've never tried it with OpenJDK, but it should work as well.

     
  • Balaur
    Balaur
    2015-09-09

    I'm on Linux. Here's my configuration:

    $ update-alternatives --display javaws
    javaws - auto mode
      link currently points to /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws
    /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws - priority 1061
      slave javaws.1.gz: /usr/lib/jvm/java-6-openjdk-amd64/jre/man/man1/javaws.1.gz
    /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws - priority 1071
      slave javaws.1.gz: /usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/javaws.1.gz
    Current 'best' version is '/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/javaws'.
    
    $ update-alternatives --display java
    java - manual mode
      link currently points to /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
    /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java - priority 1061
      slave java.1.gz: /usr/lib/jvm/java-6-openjdk-amd64/jre/man/man1/java.1.gz
    /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java - priority 1071
      slave java.1.gz: /usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/java.1.gz
    /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1069
      slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
    Current 'best' version is '/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java'.
    
    $ java -version
    Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
    openjdk version "1.8.0_45-internal"
    OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
    OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
    
    $ javac -version
    Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
    javac 1.8.0_45-internal
    

    But I was thinking... can't we get the jar from the project directly?

     
  • Balaur
    Balaur
    2015-09-11

    Give IcedTea a try.

    I already had IcedTea installed. I have the javaws executable, but there's still no trace of any jnlp or javaws jar.

    Is there a specific reason not to install Oracle Java?

    OpenJDK is available in the Ubuntu repos, while for Oracle's you'd need to add 3rd party PPAs (because of the restrictive license). I wouldn't want the users of Marauroa to have to install another JDK just for that.

    But since we already have the jar in the project, why don't we just do:

    <dependency>
        <groupId>javax.jnlp</groupId>
        <artifactId>jnlp</artifactId>
        <version>5.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/jnlp.jar</systemPath>
    </dependency>
    

    I know it's not such a great solution, and it does trigger a warning (see below), but it works.

    [WARNING] Some problems were encountered while building the effective model for net.sourceforge.arianne.marauroa:marauroa:jar:3.9.4-SNAPSHOT
    [WARNING] 'dependencies.dependency.systemPath' for javax.jnlp:jnlp:jar should not point at files within the project directory, ${project.basedir}/libs/jnlp.jar will be unresolvable by dependent projects @ line 536, column 16
    [WARNING] 
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
    [WARNING] 
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
    

    I am open to hearing other solutions.

     
    • I'm OK with it. Just remove the scope entry, is no longer needed if using a local file. That's the reason of the warning.

      Another option is to install the local file during the build. like this:

      <build>
        <plugins>
          <plugin>
            <groupid>org.codehaus.mojo</groupid>
            <artifactid>exec-maven-plugin</artifactid>
            <version>1.2.1</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>install-in-repo-jnlp</id>
                <phase>validate</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>mvn</executable>
                  <arguments>
                    <argument>install:install-file</argument>
                    <argument>-Dfile=${project.basedir}/libs/jnlp.jarr</argument>
                    <argument>-DgroupId=javax.jnlp</argument>
                    <argument>-DartifactId=jnlp</argument>
                    <argument>-Dversion=5.0</argument>
                    <argument>-Dpackaging=jar</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      

      Haven't tried it but should work.

       
      Last edit: Javier A. Ortiz Bultron 2015-09-11
  • Balaur
    Balaur
    2015-09-11

    We also need to add these dependencies (on the perception_json branch):

    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>9.2.5.v20141112</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty.websocket</groupId>
        <artifactId>websocket-servlet</artifactId>
        <version>9.2.5.v20141112</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
    </dependency>
    
     


Anonymous


Cancel   Add attachments