publishToMavenLocal doesn't work from within the test method

When I run ./gradlew publishToMavenLocal directly, I can see the jar file and pom file in the directory. However, once the verifyMavenJarsCreated task is run, it cleans previous jars but fails to create new ones. I suspect the task publishToMavenLocal fails to work for some reason.
I have applied the required plugin. Any hints? Thanks

Even i’m getting same error from last night. i have tried all possible things. but still it is not resolved. Share the solution if you resolve it.

@Jayesh you don’t have to apply any plugin.

1 Like

no plugin is applied. verifyMavenJarsCreated is not doing the job to publishtolocalmaven.

Check this out guys.

jar and pom file are being created when we run publishtomavenlocal. im able to see the file.
but if i run verifyMavenJarsCreated, the directory is deleted.

1 Like

@Jayesh @Ajaybarath, you don’t have to run publishtomavenlocal explicitly. verifyMavenJarsCreated will automatically call publishtomavenlocal. You can check the gradle file for this.

I know that running the task manually isn’t required. It was a debug step. I wanted to check if my jar and pom files are getting created and they were. The problem as I have already mentioned is that the task publishToMavenLocal when run from within the test task doesn’t perform its supposed function

1 Like

publishtomavenlocal is not doing the job when called with verifyMavenJarsCreated. but working when called just 'publishtomavenlocal ’ seperately.

1 Like

@Ajaybarath, check your build.gradle file for the verifyMavenJarsCreated task. You might find the error there.

this line is not doing the job. cleanupcriojars is working fine and clearing up the directories, but the next line is failing to execute.

This is the issue; the task has no actions. Will have to figure out what that implies.

Where did you add versioning info? if you are not able to call this target from within some other target, it can be a code issue, as well…

Can you try a clean before you run next time?
also try to run with --info or --debug and get the full log here, please.

up-to-date error means that does nothing upon execution.

@anand-crio can you check into this problem. I’ve been stuck with this from yesterday.
Please see the snippets shared in this discussion.

Hey, find the task verifyMavenJarsCreated and understand every line of it. Try making a small change to it if you feel anything is not right in that task.

i tried as much as i can. can u give some hint on this @abhishek_chandar.

Hi @Jayesh,

As far as my understanding goes, the verification task would not clear your jar files and then carry out the task of creating new ones using publishToMavenLocal. Had that been the case, the mere execution of verifyMavenJarsCreated would have completed the milestone.

I suspect you might have added extra dependencies or code to the build.gradle files. Please note that you only need to add the given parameters to build.gradle inside the qmoney directory. You don’t need to create any additional tasks inside that file or add any dependency. Just adding those 3 parameters would be sufficient.

Also, as suggested, try running a clean before running the command next time.

Let me know if the issues persists!

@Ajaybarath, the task checks if a particular directory exists. But if the path does not exist after running the verifyMavenJarsCreated in spite of you creating the directory, then what do you infer from this?

PS: I had to make a change in that task for the build to get successful.

Ok… Can you guys confirm that you havent modified anything inside your build.gradle except the changes required for this change?

All we expect you to do is - modify qmoney/build.gradle file inside publishing task. No changes are except in any other build.gradle. Please refrain from making those changes.

1 Like