TomEE maven not getting updated class files - java

I have a maven project that I run it using TomEE. I had to modify the source code, then wanted to run the project again on TomEE. The class files got updated, however, TomEE is still running the older version of the project. I noticed that too when I run test in debug it works fine, but when I run TomEE in debug the new source code lines are not recognized during debug. What is the command I should call to make TomEE get the updated class files to run it?
Note that I used: mvn clean install, mvn build and mvn clean package, and to run or debug I used: mvn tomee:run and mvn tomee:debug

Related

I built my project using IntelliJ and it changed my classpath, how can i go back?

Using IntelliJ Community Edition 2022.3.2 for Windows 10, I was debugging my webapp just fine until I decided to run some unit tests manually by going to the file in the proyect explorer, double clicking it and selecting "run".
After doing that, the remote JVM Debug I had been using for months stopped working in the sense that it no longer stops at breakpoints even though it shows its connected.
After quite some digging I found that IntelliJ builds the project before running the tests as shown here and therefore messes up my Java classpath. Normally I build my project via CMD using maven (mvn package and then mvn install) to install the built project in my local maven repository and that's where IntelliJ picks ups the classes but now it's picking up the classes that are the product of that build that happened because of that unit test run.
To give more context, my project is called "JavaClasses" and when I run mvn install each of the folders that are direct childs to the JavaClasses folder gets installed in my local maven repository and the output in the terminal is something like this for each child
[INFO] Installing C:\Users\MyUsername\Desktop\Genexus\JavaClasses\gxcloudstorage-tests\target\gxcloudstorage-tests-2.10-SNAPSHOT.jar to C:\Users\MyUsername\.m2\repository\com\genexus\gxcloud
storage-tests\2.10-SNAPSHOT\gxcloudstorage-tests-2.10-SNAPSHOT.jar
[INFO] Installing C:\Users\MyUsername\Desktop\Genexus\JavaClasses\gxcloudstorage-tests\.flattened-pom.xml to C:\Users\MyUsername\.m2\repository\com\genexus\gxcloudstorage-tests\2.10-SNAPSHOT
\gxcloudstorage-tests-2.10-SNAPSHOT.pom
So my question is, how can I go back? I would assume it´s a Java thing because there is no way for the IDE to know which copy of the class gets loaded
The route to the parent folder of the project in maven local repository is C:\Users\MyUsername\.m2\repository\com so I tried setting my classpath via CMD like this set classpath=C:\Users\MyUsername\.m2\repository\com but it did not work

Intellij doesn't navigate to the code lines in the stack trace for locally build/installed sources

I use a locally built eclips.jdt in my project. I use the command mvn -P build-individual-bundles package to build the package locally and installed the created jar file using mvn install:install-file -Dfile=/location/org.eclipse.jdt.core-3.24.0-SNAPSHOT.jar -DgroupId=org.eclipse.jdt -DartifactId=org.eclipse.jdt.core -Dversion=3.24.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
Currently, I have a java.lang.ArrayIndexOutOfBoundsException that's firing from the locally built eclips.jdt. The stack trace given in the IDE doesn't go to the correct code line in eclips.jdt or some code links are not clickable either. But I observed that this does not happen for the jars that I downloaded from the maven central repository. This happens only for the locally built jars.
I further noticed that when I add a debug point to the JavaASTUtil.java:89, the debugger does not step into the code lines that are in the locally built jars either.
Does anybody have an idea about this behavior?

IntelliJ fails on every test on a maven imported project

I imported a maven project to intellij with two modules under a parent project.
The test I want to run is made with TestNg and when I run it I just get a single line of:
java.lang.NullPointerException
No stacktrace, nothing.
If I run it from the command line it works, but only if I cd into the directory of one of the modules.
So basically thats the command that actually works:
cd server
mvn -Dtest=ConversionServiceT2 test
I'm pretty sure I didn't configure IntelliJ in the right way, but I have no idea where to start.
Here a few infos that might help:
I use the openJDK 11
I tried to set the working directory of the test config in IntelliJ to the server directory, which results in the same error
So how can I get this test (or tests in general) to run?

Java run time error when running the jar created from Maven (3.0.5) build using ess_es_server, ess_japi jar

I have a strange issue; I'm trying to run the jar created from maven build thru command prompt, but it gives run time error. When I'm running this from eclipse, it runs fine. Also, build is successful. Here's what I'm doing:
Created a java swing project (java 1.7) and tested successfully in eclipse
pushed the code to git for others to review and to be merged to master
once I got the go ahead after some minor changes (comments only), cloned it to a dev folder and keep it separate
ran mvn archetype:generate and create a mvn project w/ pom.xml
import this project to eclipse and retrofit the clean code from dev folder
modified pom.xml for dependency on the 3rd party jars (ess_es_server, ess_japi) and saved in eclipse.
came back to cmd prompt;compiled, packaged to create the jar- it was successful
while launching the app (java -cp < cp with jar) pkg.app, it gives error
“…java.lang.NoClassDefFoundError: com/essbase/api/base/EssException” whenever it's trying to invoke that particular class pertaining to one of the 3rd party jars
I have installed these 3rd party jars to my .m2 repo since they are not available in public repository.
Can someone help? My suspicion is my GAV parameters are not correct.
While running explicitly mention the library from where java program should pick up the jars; .m2 repo is used for compilation time only.

How to run the downloaded project through eclipse

I am referring "http://krams915.blogspot.in/2011/01/spring-mvc-3-hibernate-annotations.html" blog and at end of the blog there is source code in zip folder i have downloaded but i dont know how to run in Eclipse,
at the last on blog they have mention
You can run the project directly using an embedded server via Maven.
For Tomcat: mvn tomcat:run
For Jetty: mvn jetty:run
I dont know how use this steps.please help me how to run this project,
I am using tomcat as my server,
Thanks,
Basically you need to do two things:
Install maven plugin in eclipse.
Add a tomcat server instance in eclipse.
This link should guide you to achieve that:
http://www.mulesoft.com/tomcat-maven
Install Maven
go through command line to your project folder
call mvn tomcat:run or mvn jetty:run
1.Install Maven
2.set system enivorment
3.go through command line to your project folder(where the pom.xml is)
4.call mvn tomcat:run or mvn jetty:run
Download Spring Source Tool suite which comes along with maven. It maked things little easier for you. You can directly run maven projects from the IDE itself.

Categories

Resources