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

Add IDEA classpath for Development mode #323

Merged
merged 2 commits into from Sep 5, 2019
Merged

Add IDEA classpath for Development mode #323

merged 2 commits into from Sep 5, 2019

Conversation

hank-cp
Copy link
Contributor

@hank-cp hank-cp commented Jun 12, 2019

According to IDEA help, add default IDEA classpath in case developing in IDEA.

For reference, IDEA classpath setting should be changed as here

@coveralls
Copy link

Pull Request Test Coverage Report for Build 543

  • 0 of 3 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 54.361%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pf4j/src/main/java/org/pf4j/DevelopmentPluginClasspath.java 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
pf4j/src/main/java/org/pf4j/DevelopmentPluginClasspath.java 1 0.0%
Totals Coverage Status
Change from base Build 528: -0.3%
Covered Lines: 910
Relevant Lines: 1674

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 543

  • 0 of 3 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 54.361%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pf4j/src/main/java/org/pf4j/DevelopmentPluginClasspath.java 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
pf4j/src/main/java/org/pf4j/DevelopmentPluginClasspath.java 1 0.0%
Totals Coverage Status
Change from base Build 528: -0.3%
Covered Lines: 910
Relevant Lines: 1674

💛 - Coveralls

@decebals
Copy link
Member

decebals commented Aug 31, 2019

@hank-cp
I am so sorry for the delay I answer you.
The delay is generated by the fact that, from the beginning I was not convinced by the utility of this PR. Is this PR useful for you? Do you use this setting in your projects developed with IntelliJ?
I ask you because I use IntelliJ also in my projects and I don't see how this PR will help me.
See below a test project that is created using the quickstart Maven archetype introduced by PF4J 3:
image
The structure is very similar with demo included in PF4J:

  • app maven module (contains application and API)
  • plugins maven module that is the parent of each plugin developed for application
  • hello and welcome plugins (maven modules)

I run my quickstart application via Boot class:
image
I specify that I want to run PF4J in dev mode with -Dpf4j.mode=dev.
In quickstart project we use Maven so we already have the information where the class files are available.

My specific question for you is: in what scenario (use case) the modifications proposed by you in this PR are useful? We are covered already for Maven and Gradle (build automation systems). My feeling is that you don't use one of these tools and, in this case, it's difficult to package your jars, ... (other operations related to build process).

@hank-cp
Copy link
Contributor Author

hank-cp commented Sep 2, 2019

Hi @decebals

I am using IDEA and gradle. The problem is for the main app, it will need to locate plugins' output classes folder. For IDEA, by default, it is under out folder (as described here), which is not covered by DevelopmentPluginClasspath. Although I could change it in IDEA project setting, but it will recover everytime I refresh from Gradle settings.

Here is my IDEA plugin module settings:
image

And how my project structure looks like:
image

  • the out folder is generated by IDEA.
  • the build folder is generated by Gradle.

@decebals
Copy link
Member

decebals commented Sep 4, 2019

@hank-cp
Thanks for explanations. I understand the problem.
I think that maybe something is wrong in your Idea config of the project.
For example, I use Maven with Idea in all my projects.
After I tell to Idea that my project uses Maven, all the classes are generated automatically in target\classes. This location is taken from Maven automatically without to touch project's settings:

image

image

Again, all is made automatically by Idea IntelliJ. I don't remember to see a directory out (standard compiler output) in my projects. All you have to do is to specify that your project is based on Maven when you create the project in Idea IntelliJ.
I expected the same behavior for Gradle and IntelliJ.
Maybe other people that use Gradle and IntelliJ can confirm and invalidate what I tell you in this comment.

@hank-cp
Copy link
Contributor Author

hank-cp commented Sep 5, 2019

Indeed, the out folder is generated by IDEA, while build/target is generated by Gradle or Maven.

If I compile and launch my app by Gradle/Maven task, build/target will be there so everything is just fine.

But when I compile and launch my app by IDEA, everything goes to out, and pf4j cannot locate class files properly, since out is not in its development classpath by default.

Right now I could always add out to development classpath in my project setting to walkaround. But I think it's good to add it to default since IDEA is getting more and more wild use.

@decebals
Copy link
Member

decebals commented Sep 5, 2019

But when I compile and launch my app by IDEA, everything goes to out,

What I'm trying to say is that it doesn't happen in my projects. When I specify in Idea that I use Maven in my project (when creating the project), it's smart enough not to create and use the out directory, and use the target directory (Maven standard output directory).

@hank-cp
Copy link
Contributor Author

hank-cp commented Sep 5, 2019

According to this: https://stackoverflow.com/a/46035904/482533

IntelliJ IDEA is no longer sharing the output with Gradle.

For me, I agree and prefer to separate them. out holds development optimized outputs and build holds production optimized outputs.

I am using IDEA 2019 BTW :)

@decebals
Copy link
Member

decebals commented Sep 5, 2019

According to this: https://stackoverflow.com/a/46035904/482533

Nice information. Thanks!

In this case, if you say that this PR solves your problem, I will merge it on master.

@decebals decebals merged commit cc6fe5e into pf4j:master Sep 5, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants