Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#18195 closed defect (fixed)

Mapillary plugin ant build failure

Reported by: Don-vip Owned by: jpietri
Priority: normal Milestone:
Component: Plugin mapillary Version:
Keywords: test json build Cc: floscher

Description

See below:

build-jar:
      [jar] Building jar: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/dist/Mapillary.jar
      [jar] Building jar: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/dist/Mapillary-sources.jar
      [jar] Building jar: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/dist/Mapillary-javadoc.jar

post-dist:

test-clean:
   [delete] Deleting directory /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/build
   [delete] Deleting directory /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/report
   [delete] Deleting: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/jacoco.exec
   [delete] Deleting: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/00_core_test_config/unit-josm.home/preferences.xml

check-test:

test-init:
    [mkdir] Created dir: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/build
    [mkdir] Created dir: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/build/unit
    [mkdir] Created dir: /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/report
     [copy] Copying 1 file to /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/00_core_test_config/unit-josm.home

test-compile:
    [javac] Compiling 36 source files to /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/build/unit
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:11: error: package org.json does not exist
    [javac] import org.json.JSONException;
    [javac]                ^
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:13: error: package org.skyscreamer.jsonassert does not exist
    [javac] import org.skyscreamer.jsonassert.JSONAssert;
    [javac]                                  ^
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:23: error: cannot find symbol
    [javac]   public void testSingleImageChangeset() throws JSONException, URISyntaxException {
    [javac]                                                 ^
    [javac]   symbol:   class JSONException
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:35: error: cannot find symbol
    [javac]   public void testTranslationOnlyChangeset() throws JSONException, URISyntaxException {
    [javac]                                                     ^
    [javac]   symbol:   class JSONException
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:46: error: cannot find symbol
    [javac]   public void testRotationOnlyChangeset() throws JSONException, URISyntaxException {
    [javac]                                                  ^
    [javac]   symbol:   class JSONException
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:70: error: cannot find symbol
    [javac]   public void testMultipleImagesChangeset() throws IllegalArgumentException, URISyntaxException, JSONException {
    [javac]                                                                                                  ^
    [javac]   symbol:   class JSONException
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:31: error: cannot find symbol
    [javac]     JSONAssert.assertEquals(expected, actual, true);
    [javac]     ^
    [javac]   symbol:   variable JSONAssert
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:42: error: cannot find symbol
    [javac]     JSONAssert.assertEquals(expected, actual, true);
    [javac]     ^
    [javac]   symbol:   variable JSONAssert
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:53: error: cannot find symbol
    [javac]     JSONAssert.assertEquals(expected, actual, true);
    [javac]     ^
    [javac]   symbol:   variable JSONAssert
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] /var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/Mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/api/JsonLocationChangesetEncoderTest.java:89: error: cannot find symbol
    [javac]     JSONAssert.assertEquals(expected, actual, false);
    [javac]     ^
    [javac]   symbol:   variable JSONAssert
    [javac]   location: class JsonLocationChangesetEncoderTest
    [javac] 10 errors

BUILD FAILED
/var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/build.xml:47: The following error occurred while executing this line:
/var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/build.xml:24: The following error occurred while executing this line:
/var/lib/jenkins/jobs/JOSM-Plugins/workspace/jdk/JDK8/build-common.xml:581: Compile failed; see the compiler error output for details.

Total time: 3 minutes 29 seconds
Build step 'Invoke Ant' marked build as failure

It breaks our Plugins Jenkins job.

Attachments (0)

Change History (6)

comment:1 by jpietri, 6 years ago

JSONAssert is a new test dependency declared in the plugin Gradle build file gradle.built.kts like this testImplementation("org.skyscreamer:jsonassert:1.5.0")
JSONException is a transitive dependency from JSONAssert, declared in its pom.
It works locally for me.
Seems to work on the Mapillary plugin CI as well:(https://josm.gitlab.io/-/Mapillary/-/jobs/308670791/artifacts/build/reports/tests/test/classes/org.openstreetmap.josm.plugins.mapillary.utils.api.JsonLocationChangesetEncoderTest.html)).

Any clue @floscher, @Don-vip ?

comment:2 by floscher, 6 years ago

I'll fix that.

@jpietri: Yes, the Gradle build works fine. But on the Jenkins server the plugin is built using Ant, but since Ant doesn't use Maven dependencies, such external dependencies need some workaround. For the wikipedia plugin I'm using an ivy.xml file do define such dependencies, because that can be read by both Gradle and Ant.
Or could the same thing maybe also be achieved without that dependency?

comment:3 by jpietri, 6 years ago

Ah, ok @floscher! Was hoping there was already some smart boilerplate component making Ant being aware of the Gradle dependencies.
Well, I can do without JSONAssert, but it makes JSON assertion failures much easier to spot than a full text comparison, where different formatting and sorting may fail for a correct JSON doc.
Also, generally speaking, it would be more comfortable to be able to add new dependencies when needed. So, using an Ivy file could be a good compromise.

Nevertheless, let me know if it is an issue, I will revert to a text comparison, as it was before.

comment:4 by Don-vip, 6 years ago

An ivy file is ok. To test, please run ant clean test. It must end with BUILD SUCCESSFUL.

comment:5 by floscher, 6 years ago

I now replaced the dependency with a custom method JsonUtils.assertJsonEquals(). It is more advanced than what was there previously, different ordering in JSON objects doesn't matter, in JSON arrays order matters (e.g. for coordinates it matters what number comes first). When there is a difference it only (pretty-)prints out the part that differs and a "path" to where there is a difference:

Expected:

{
  "a":"A",
  "b":[
    {"d":"D"},
    {"e":"E", "f":{"g":"G"}}
  ],
  "c":"C"
}

Actual:

{"c":"C","a":"A","b":[{"d":"D"},{"e":"E","f":1.0}]}

Output of JsonUtil.assertJsonEquals():

JSON values have different type at /b[1]/f

Expected:

{
    "g": "G"
}

Actual:

1.0

 expected:<class org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl> but was:<class org.glassfish.json.JsonNumberImpl$JsonBigDecimalNumber>
Expected :class org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl
Actual   :class org.glassfish.json.JsonNumberImpl$JsonBigDecimalNumber

Since that's only ~50 lines of code and parsing the XML of the ivy.xml in order to add the content to the Gradle build would also add overhead, I decided to go with writing that custom method, which probably should be enough.

If in the future there'd be a library that you'd like to add, I'd happily reconsider adding an ivy.xml, but I think at the moment it's not necessary.

Version 0, edited 6 years ago by floscher (next)

comment:6 by floscher, 6 years ago

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jpietri.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.