Creating new package in community
I am really getting killed here. In community source, I created a new module (new->module) and in that a Hello World Java class . WHen I build the new module does NOT show up in the out->production directory. I have to guess that there is a build script(s) between me and make that is causing this. I am not anxious to plunge into multiple ANT GANT scripts with al their variables and dependencies and all that just to be able to add a module
The HelloWorld module is just a cheap test to try and trouble shoot a problem I had when I tried to add a homegrown unit testing plugin framework and was copying what I saw junit did as far as configuration goes.
In that case I was creating file templates like junit and placing those templates in a directory structure that mimics junits own file structure. Good enough for now. I should say here that I added the my module to the module "plugins" next to all the other plugins and using the project structure screens and declared the dependencies on test-framework and all the rest and implemented JavaTestFramework etc etc and also a proper plugin.xml, the META-INF and added the dependencies therein. All that stuff. Done.
I noticed that despite Community finding my plugin and using its classes, - it knows there's a new test framework in town and shows that to me as a choice in the createTestDialog, build (make) absolutely was not not not transferring (the coimpiled version of) the folder with the source of the plugin from source to out->production . Actually that's a bit of a mystery to me because those classes are being found at runtime.
If you read Practical API Design by Jaroslav Tulach then Iam having an amoeba moment where I am discovsering that how Community gets built and what is happening when I press make-run is markedly different than the mental model I had for it.
Any help here on any aspect of this is so appreciated.
请先登录再写评论。
Please make sure that the option "Inherit project compile output path" is set under Project Structure | Modules | <your module> | Paths. The Make action for Community Edition does the regular IntelliJ make; there is no Ant or Gant involved. The Gant scripts are only used to build the IntelliJ IDEA distribution and to run its tests on a continuous integration server.
Yes I did have that done. I also tried doing the opposite, to no avail.
I am confused about how Community can find and run classes located in modules I make yet seem to not be transferring them to production->out , where I think it gets the .class files which are loaded when Community is run.
Here are some of my folk beliefs about How Community Works. I'll state them as true / false propositions and number them so that they can be answered yes or no quickly and easily. I encourage you or anyone else to answer them in just that way. They're carefuly crafted so that a simple yes/no answer to any of them is enormously helpful to me.
1 When you make Community by pushing run, any changed .java files are recompiled and the result placed into production/out/ etc etc
2 Intellij Community is just an ordinary program with respect to build- it just compiles whatever source classes are in any of its declared modules.
3 Any file present or directory structure in a module's directory that is not a .java file will simply be transferred as is to production/out/ etc etc.
The thing I didn't know to do was to use the artifacts dialog in the modules dialog to direct the creation of a jar and then add that jar as a library. At least, that solved my issue.
1. Not quite. When you push Run with the default run configuration, the module "community-main" and its dependencies are compiled. Most of the IntelliJ IDEA Community Edition modules are (directly or indirectly) in the dependencies of community-main. If your new module is not in the dependencies of community-main, it will not be compiled.
2. Yes
3. Not necessarily. Non-Java files will be copied to the output directory only if they match the patterns specified under Settings | Compiler | Resource patterns.