Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting Maven tests to Gradle tests #91

Closed
bbaudry opened this issue May 26, 2021 · 6 comments
Closed

Porting Maven tests to Gradle tests #91

bbaudry opened this issue May 26, 2021 · 6 comments

Comments

@bbaudry
Copy link
Member

bbaudry commented May 26, 2021

This folder includes small Maven projects to be used for testing Depclean with Maven:
https://github.com/castor-software/depclean/tree/master/depclean-maven-plugin/src/test/resources-its/

@ABHAY0O7, can you add build.gradle files for each of these projects, so you can use them to test the Depclean gradle plugin?

@ABHAY0O7
Copy link
Contributor

Hi! @bbaudry,
I think you are saying that I have to convert these maven projects into Gradle projects so that I can use them in testing of Gradle plugin?
If Yes, then this single command gradle init will do the whole work for me.
If this approach is not correct, then enlighten me with some correct ways of doing this.

Thank you

@bbaudry
Copy link
Member Author

bbaudry commented May 26, 2021

I think you are saying that I have to convert these maven projects into Gradle projects so that I can use them in testing of Gradle plugin?

You are right @ABHAY0O7, that's exactly the goal

@ABHAY0O7
Copy link
Contributor

Hello @bbaudry @tdurieux
I need some help!
As in the Maven plugin, we copy all the dependencies locally by invoking the maven command
mvn dependency:copy-dependencies -DoutputDirectory=$buildDir\dependencies. See here
But in a Gradle project to copy dependencies locally, I am unable to find the exact command which can be directly used from the terminal. All I am getting is this configurations that I have to add manually in my buld.gradle file.

task copyToLib(type: Copy) {
    into "$buildDir/output/lib"
    from configurations.runtime
}

But I need the corresponding command that I can directly invoke from the terminal.
Can you please tell me the exact command for this?

Thank you
Abhay

@tdurieux
Copy link
Contributor

There is probably no command for that. You will need to code it. You can do that by taking the classpath and copying all the dependency in the good folder

@ABHAY0O7
Copy link
Contributor

Yes, I can code it in my build.gradle and use the task through the command line but, when the users will use the plugin then I have to explicitly tell them to add this

task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.runtime
}

section in their build.gradle file along with the plugin configurations.
Will that be okay?
Or is there any other way so that I can directly write to their build.gradle file and can use this task in the backlog directly through my code?

@tdurieux
Copy link
Contributor

tdurieux commented Jun 2, 2021

I meant that you can replace this part of the code https://github.com/castor-software/depclean/blob/cbfc3954b429a124d92d18f125aac3daaf0b5f68/depclean-maven-plugin/src/main/java/se/kth/depclean/DepCleanMojo.java#L370 with your own java method that does the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants