I have multiple apps and inline plugins I want to be all next to each other so in IntelliJ I can have them all open at once and edit anything in any of them, refactoring work across all of them, etc.
And I want to have a top level build that will build everything.
I'm using grails 2.2.4 and maven
I looked at create-multi-project-build and all manner of links that talked about it but can't get it to work with the inline plugin. When it gets to building the app, for some reason it tries to compile the plugin files and gets lots of compile errors because it is not seeing the plugin's dependencies.
NOTE: Apparently the plugin pom.xml doesn't have the dependencies. So, is there a bug, or am I doing something wrong that would make it not find dependencies?
[INFO] --- grails-maven-plugin:2.2.4:maven-compile (default-maven-compile) # my-app ---
|Loading Grails 2.2.4
|Configuring classpath
|Running pre-compiled script
.
|Environment set to development
......Warning
|
No plugin [my-plugin-0.1-SNAPSHOT] installed, cannot uninstall
....
|Compiling 132 source files
.Error
|
Compilation error: startup failed:
Compile error during compilation with javac.
/path/to/file/in/my-plugin:3: package groovyx.net.http does not exist
import groovyx.net.http.AsyncHTTPBuilder;
^
etc. (lots more of the same kind of errors)
Is there some way to get this to work? If this maven build is the only option, I'd really like a solution that does not require manually editing the pom's. That way I can just regenerate them whenever I need to update the build.
Are there other straightforward options to creating a multi-module build for this case?
Further detail:
Running grails test-app in the plugin or in the app work successfully.
Related
I have a Maven multi-module project on IntelliJ that produces 3 jars, 2 of which are executables and the other one is for commmon resources.
One of the executable modules has a main class that asks if the user wants to start the program with CLI or GUI.
Running this main from IntelliJ works without problem, instead when I use Maven to make the jar (using maven shade):
mvn package -pl myModule -am
and then launch the jar with GUI option, this warning appears:
com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module #...'
The GUI then starts without problems.
How can I get rid of this warning?
The JDK of my project is openJDK 16 (I've already added module-info.java in order to work with javafx), openJFX 16, maven shade plugin 3.2.4, maven compiler plugin 3.8.1.
If there's need to add furthermore information, I'll add them.
It seems that maven is shading the JavaFX jars into a single fat jar.
Shading multiple modules into the same jar is not possible, because a jar can only contain 1 module. So, I suppose the shade plugin resolves that problem by removing the module-info files of the dependencies it's using, which means the JavaFX code will not be loaded as a module, and you get a warning like this.
I think the only way to get rid of the warning is to not use shading, but keep the JavaFX modules as separate jar files, that you then put on the module path when running the application.
I just converted my Maven project to a gradle project. It was a multi project structure:
master-project
pom.xml
---->project1
-------->pom.xml
---->project2
-------->pom.xml
---->project3
-------->pom.xml
I ran a gradle init on it and have this structure now:
master-project
build.gradle
---->project1
-------->build.gradle
---->project2
-------->build.gradle
---->project3
-------->build.gradle
Everything builds fine, and I have been able to get some things done with that I couldn't figure out how to do with Maven, so that's great. Next step was to integrate that into the IDE since the Maven Dependencies are gone since I have removed the pom.xml files.
However the project isn't recognized as a gradle project - and I am not sure how to change that?
In Eclipse Mars it's still recognized as a Maven build, not gradle....
Thanks in advance.
EDIT: I reimported the projects which enabled the plugin for Eclipse. Now I am having weird behavior.
The build works from the command line, however when attempting the same execution from within Eclipse, it fails trying to copy the file dependencies.
For example:
Couldn't copy dependency jakarta-regexp-1.4.jar
java.nio.file.NoSuchFileException: C:\Users\user.m2\repository\jakarta-regexp\jakarta-regexp\1.4\jakarta-regexp-1.4.jar -> build\jfx\app\lib\jakarta-regexp-1.4.jar
I haven't changed the repo from maven yet - just changed the build scripts. This is running from the master project. So I am confused as to why the script would work from the commandline but not from within eclipse.
EDIT 2: Turns out this behavior is also present when running from the command line when the --daemon flag is set. Is there anyway to run the tasks without the daemon in Buildship? Or perhaps a way to fix this issue when the --daemon flag is enabled?
Thanks.
The issue with the build was that there is a leak in the JDK when bundling the JRE with the native app. This only happens when running with the --daemon flag (which all IDEs user). Therefore until this is fixed you will need to run gradle --stop and then run the clean.
The plug in I am using is no longer running the native task when running with --daemon.
I'm using maven to set up a war project in IntelliJ and run in it GlassFish. The war project depends on several other modules. When I run the project in debug mode, hot deploying codechanges of the changes results in NoClassDefFound exceptions. I found out that IntelliJ tries to redeploy the module jar but GlassFish keeps a lock on it so it fails. All the classes in that module are now unavailable, causing these NoClassDefFound exceptions.
IntelliJ generates the artifacts this way: the dependent modules are all added as jar dependencies as if they were external dependencies:
Now, when I remove the jar dependencies, IntelliJ tells me it found some missing dependencies and proposes a fix to add the missing dependencies.
Fixing those dependencies will add the module compile output to the WEB-INF\classes folder.
Once deployed, IntelliJ has no problem anymore hot-deploying changed classes to GlassFish since there's no jar to keep a lock on.
Problem
Every time I make a change to any pom.xml, IntelliJ refreshes the artifacts automatically, which is fine: I definitely want to see those changes appear in the artifact. However, all modules are added as jar dependencies again.
Question
How can I make sure that IntelliJ adds the compile output of project modules to WEB-INF\classes and not to WEB-INF\lib?
I found this question but it has two problems:
There are many module dependencies so if possible I'd like to avoid specifying them all one by one in the unpack goal
IntelliJ seems to ignore this. When I add that configuration and while it works perfectly in a maven commandline build, IntelliJ still refuses to add the module compile output to the WEB-INF\classes dir
I found a bugreport that asks about the same thing but for me it's hard to believe there's no way to solve this problem. Other webapp developers using IntelliJ must have this same issue, making it difficult to hot-deploy code changes, unless I did something wrong in my pom configuration.
Background:
I am developing Maven multi module project.
One of the module is common module needed by other all modules.
This module contain CommonClassA.java.
common module is properly compiled.
It is installed into maven local repository properly.
One of the class(Billtype.java) in other module (EmployeeBilling) refers this class(CommonClassA.java).
Maven Dependency for common module is properly specified in pom.xml of EmployeeBilling module.
Problem:
While compiling EmployeeBilling module it throws
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project EmployeeBilling: Compilation failure
[ERROR] \MyWorkspace\Biz\EmployeeBilling\src\main\java\com\employee\Billtype.java:[79,19] error: cannot access CommonClassA
[ERROR] -> [Help 1]**
Supporting details:
dependency defined in EmployeeBilling> pom.xml:
Other classes from common module seems accessible as no error observed
There are no other errors like Class not found/file not found.
The class CommonCLassA implements Serializable
Same error occurs from Eclipse as well as commond line
I am using M2E plugin
Tools:
jdk1.7.0_02
OS: Windows 7
Eclipse JUNO and apache-maven-3.1.0
Thanks in advance!
If project builds properly using eclipse compiler then it should work with Maven.
Few things to check if its not working with maven:
Manually check in repository that jar is installed properly and it contains your class file.
Try to build project using locally installed Maven instead of maven in eclipse.
Set -DskipTest=true while installing your jar, as it can cause issues at times.
If these steps don't work then show us your pom.
With no more information it's hard to find the cause. But I also had this problems now and then, and there are some things which could go wrong:
Are you using the right JAVA version (everywhere) ?
... and the right java PROVIDER? (Oracle, IBM, OpenJDK) In my case it's often this issue, I'm sometimes bound to IBM JDK, although I try to use Oracle where I can and this sometimes breaks my build.
Is the right maven dependency VERSION used? If you depend on it multiple times, and all in the same (lower than root) dept of dependencies, Maven will just "choose" a version. It could be that thát version is incompatible with your code of thát particular dependency
Skipping tests sometimes WORKS! It has something to do with maven phases and getting stuff ready for using it elsewhere.
Good luck :)
I had the same problem. Even the jar dependency has the required class files. Finally I deleted the local maven repo and restarted the build. Now it worked without any issue.
It looks like you are using an old version of maven-compiler-plugin (v2.3.2).
I suggest you upgrade it to 3.x. it won't magically fix your issue but it will definitely give you better / more detailed error message.
I have a multi-module maven build configured to run CheckStyle. It works, but it fails as soon as it comes across a module with a violation. How can I process all modules but not fail until the very end? I'd like to be able to see all violations without having to fix/re-run repeatedly.
I'd advise to do this in your IDE, to get checkstyle violations feedback while you code, and not only late when building using Maven. Still keep maven checking for violations, and fail a build as early as possible, on first module with violations.
E.g. there is eclipse-cs, checkstyle plugin for eclipse IDE. To have both maven-checkstyle-plugin and eclipce-cs use same checkstyle configuration file, install m2e eclipse plugin and it's extensions including one for eclipse-cs.