question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

travis build for own 3rdparty cordapps is failing due to -sources.jar in classpath

See original GitHub issue

while building a 3rdparty library and running testcases using cordapp Testnetworks the tests are crashing

version:

        corda_release_group = 'net.corda'
        corda_release_group_plugins = 'net.corda.plugins'
        corda_release_version = '4.1'
        corda_gradle_plugins_version = '4.0.42'

exception during tests

ch.cordalo.corda.common.flows.test.TestBaseFlowTests > testCreate FAILED
   java.lang.IllegalArgumentException: There is more than one CorDapp containing the package ch.cordalo.corda.common.contracts on the classpath 
[/home/travis/build/cordalo-ch/cordalo/corda-common/build/libs/corda-common-contracts-0.1-SNAPSHOT-javadoc.jar, 
/home/travis/build/cordalo-ch/cordalo/corda-common/build/libs/corda-common-contracts-0.1-SNAPSHOT.jar]. 
Specify a package name which is unique to the CorDapp.
       at net.corda.testing.node.internal.TestCordappImpl.getJarFile(TestCordappImpl.kt:34)

reproduce bug

  • create a 3rd party library
  • implement a test case and use MockNetwork with parameters network = new MockNetwork(new MockNetworkParameters(testCordapps));
  • use standard ‘maven’ plugin and ‘signing’ plugin to upload at the end the artifacts to OSS
    apply plugin: 'maven'
    apply plugin: 'signing'

  • build sources and javadoc as seperate .jars for OSS maven repo
     task javadocJar(type: Jar) {
        classifier = 'javadoc'
        from javadoc
    }
    task sourcesJar(type: Jar) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }
    artifacts {
        // dont add javadocjars and source to it because travis is not able to build
        // archives javadocJar, sourcesJar
    }

issue if

  • archives are built for javadocJar and sourcesJar

archives javadocJar, sourcesJar working if commented // archives javadocJar, sourcesJar

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cedricwaltercommented, Oct 31, 2019

Lost some time and was facing the same issue, till i found this fix. When will it will integrated in Corda 4.4+ ?

1reaction
lolo8304commented, Aug 30, 2019

solution to be implemented in: TestCordappImpl.kt

  • remove -sources.jar and -javadoc.jar patterns as -test.jar pattern below

Original

        private fun findRootPaths(scanPackage: String): Set<Path> {
            return packageToRootPaths.computeIfAbsent(scanPackage) {
                val classGraph = ClassGraph().whitelistPaths(scanPackage.replace('.', '/'))
                classGraph.pooledScan().use {
                    it.allResources
                            .asSequence()
                            .map { it.classpathElementFile.toPath() }
                            .filterNot { it.toString().endsWith("-tests.jar") }
                            .map { if (it.toString().endsWith(".jar")) it else findProjectRoot(it) }
                            .toSet()
                }
            }
        }

fixed

        private fun findRootPaths(scanPackage: String): Set<Path> {
            return packageToRootPaths.computeIfAbsent(scanPackage) {
                val classGraph = ClassGraph().whitelistPaths(scanPackage.replace('.', '/'))
                classGraph.pooledScan().use {
                    it.allResources
                            .asSequence()
                            .map { it.classpathElementFile.toPath() }
                            .filterNot { it.toString().endsWith("-tests.jar") }
                            .filterNot { it.toString().endsWith("-javadoc.jar") }
                            .filterNot { it.toString().endsWith("-sources.jar") }
                            .map { if (it.toString().endsWith(".jar")) it else findProjectRoot(it) }
                            .toSet()
                }
            }
        }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Build Problems
One possible cause for builds failing unexpectedly can be calling set -e (also known as set errexit ), either directly in your .travis.yml...
Read more >
Getting an error when adding a 3rd-party jar file
:java-source:configureCordappFatJar FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':java-source: ...
Read more >
高亚斌
Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system ...
Read more >
The Blog Pros -- Simple Solutions to Succeed
Articles from Pros, Video Tips, Techniques, and Services. All at your fingertips.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found