0
votes

I have published my CorDapp (corda contracts, states and flows) project in .m2 directory by using the publish task and command: ./gradlew clean publish.

Now, when I go into my service project (seperate gradle project) to access the flow classes, I am not able to access the flows.

Also, when I am trying to build the service project, it is giving me the following error:

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com.template.blockchain.corda:contract-states:SNAPSHOT-0.0.1.
     Searched in the following locations:
       - file:/C:/Users/.m2/repository/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom
       - https://jcenter.bintray.com/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom
       - https://repo.maven.apache.org/maven2/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom
       - https://ci-artifactory.corda.r3cev.com/artifactory/corda/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom
       - https://jitpack.io/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom
       - https://plugins.gradle.org/m2/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pom

My publish code (code in Cordapp project):

publishing {
        publications {
            mavenJava(MavenPublication) {

                groupId = 'com.template.blockchain.corda'
                artifactId = 'contract-states'
                version = 'SNAPSHOT-0.0.1'
                from components.java
            }
        }
        repositories {
            mavenLocal()
        }
    }

In addition, I have written the compile line to compile the CorDapp jars in service project which are in .m2 directory.

Code:

compile group: 'com.template.blockchain.corda', name: 'contract-states', version: 'SNAPSHOT-0.0.1'
1
It seems the cordapp has not been published to the repository for some reason. Could you verify if its to mavenLocal at /C:/Users/.m2/repository/com/template/blockchain/corda/contract-states/SNAPSHOT-0.0.1/contract-states-SNAPSHOT-0.0.1.pomAshutosh Meher
I have checked with this and jar is in my .m2 directory after publish task is successful. Also would like to add that it is working fine with my another projects running on corda 4. But for this project we are on corda 4.3tejashree parab

1 Answers

1
votes

I have same issue, so I add one directory in my service project as libs, and add my corDapp jar file (corDapp -> build -> libs -> xyz.jar) in libs directory and in build.gradlew add this line compile fileTree(includes: ['*.jar'], dir: 'libs') so it add all your jar in your classpath, refresh your service gradlew project, so you can access your corDapp flow class inside your service project

let me know if need further help

Thanks