I need to try JRebel for my web app development:
Using GAE SDK version 1.8.0
Run through maven appengine:devserver
Under M2E plugin (Eclipse) or console, running Linux (Ubuntu) desktop
Documents I found online points into editing the GAE script, however what would be the approach for GAE run from Maven?
The problem here is starting up the GAE process with the JRebel JVM arguments or in general adding JVM arguments to the GAE process.
There are multiple ways of adding JVM arguments to the process, I would recommend adding those arguments to the appengine plugin
You can set JVM arguments for JRebel in your pom.xml:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
<configuration>
<jvmFlags>
<jvmFlag>-agentpath:{jrebel install directory}/lib/libjrebel64.dylib</jvmFlag>
</jvmFlags>
<disableUpdateCheck>true</disableUpdateCheck>
</configuration>
</plugin>
Where libjrebel64.dylib works for macOS, and you'd use libjrebel64.so on Linux and jrebel64.dll on Windows.
Related
I have used GRAALVM to compile native JavaFX apps. in commands ports. Here I want to do the same thing using maven.
I have GRAALVM latest version install in C and added the Environment variable as the name GRAALVM_HOME. and in PATH %GRAALVM_HOME%\bin but when I Run client:build-in IntelliJ. it says GRAAL_PATH didn't find.
I tried to do it with the client plugin.
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>${client.plugin.version}</version>
<configuration>
<target>${client.target}</target>
<mainClass>${main.class}</mainClass>
<bundlesList>
<list>com.example.sample.main</list>
</bundlesList>
<reflectionList>
<list>com.example.sample.MainController</list>
</reflectionList>
<graalvmHome>GRAALVM_HOME</graalvmHome>
</configuration>
</plugin>
inline graalvmhome I set to add the entire path that's didn't work. then I added a GRAALVM_HOME in it. but this didn't work either.
it's <graalvmHome>path to graal</graalvmHome> where path to graal is the path in your local machine e.g. /home/user/graal
I have different Java test behaviours (probably after a MacOS update to Big Sur 11.2.3 or another system).
My JUnit test requires the variable DYLD_LIBRARY_PATH on Mac and LD_LIBRARY_PATH on Ubuntu (mvn surefire is used, see below) to find some dylibs / shared objects.
Test works in IntelliJ without any problems on both OS.
But during the mvn build the DYLD_LIBRARY_PATH variable (System.getenv(..)) is null and the test fails on Mac (on Ubuntu it works). Starting mvn with '-X' shows that surefire sets the DYLD_LIBRARY_PATH, but later it is still null.
I am using maven-3.6.3, surefire 3.0.0-M5 and OpenJDK 11.0.10.
Any ideas, how I can with the environment issue?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<LD_LIBRARY_PATH>${basedir}/src/main/resources/libs</LD_LIBRARY_PATH>
<DYLD_LIBRARY_PATH>${basedir}/src/main/resources/libs</DYLD_LIBRARY_PATH>
</environmentVariables>
</configuration>
</plugin>
Pls report a bug in our JIRA and attach your project in ZIP. We need to reproduce it and debug the plugin but the project is required.
I have created a RESTful API using jersey that serves some GET endpoints. The thing though is that now I have to ship this project as github link and provide instructions to open and run the project from the command line. I completely build the project using Eclipse and have scoured the web for resources but have no clue as to how to get this done. Could someone care to download the project into their machines and help with instructions to run it from the command line. The README has the links to the public endpoints.
Without needing to actually deploy it your Tomcat instance, you can use the tomcat maven plugin (which is meant for development). It starts an embedded tomcat instance, so you can test your webapps. Just add the following to your pom.xml file
<build>
<finalName>SimpleRestApi</finalName>
<plugins>
...
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
Then from the command line you can just run
mvn tomcat7:run
And a server instance will start. You can then access
http://localhost:8080/api/courses
If you want to change the context path, just use <path>/SimpleRestApi</path>. Then you can access
http://localhost:8080/SimpleRestApi/api/courses
I'm using Eclipse Luna and have a project using Appengine java managed VM using maven. https://cloud.google.com/appengine/docs/java/managed-vms/maven
How to setup eclipse for best productivity.
I currently run mvn gcloud:run on command line and attach "Remote Java Application" Debug configuration.
I have this in my pom to enable "remote debug"
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>${gcloud.plugin.version}</version>
<configuration>
<jvm_flag>
<param>-Xdebug</param>
<param>-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n</param>
</jvm_flag>
</configuration>
</plugin>
Debug and breakpoints work but I have a problem with automatic reload.
Code rebuild and reload work but it disconnects debug every time I save a .java file.
static file (.html) rebuild/republish does not work. I have to manual run mvn install on every change.
So the question is: What are the best practices for this.
Install the Google Plugin for Eclipse (GPE)
Install jRebel - note this is a commercial product, but there are free versions for some types of usage
configure project as appengine project
add jRebel nature
Debug within eclipse
This should hot load Java, jsps, tags and web resources.
I am using Eclipse (Helios), with the "m2eclipse" plugin. I am working on a Maven-based web application project, which I test on a local Tomcat server that is setup inside Eclipse.
Generally, this works more or less great. "m2eclipse" can sometimes be flaky... but for the most part it keeps my POM and my Eclipse project settings in sync, and likewise keeps the deployed code current in Tomcat.
However, recently I've added a wrinkle. I have one JavaScript include file that needs to be different when going from the test environment to the real production environment. The differences are too significant to be cleanly handled by Maven filtering and token substitution. What I needed was to keep two separate files in my project, and only deploy the one appropriate for the build profile.
I accomplished this with some "targetPath" trickery in my Maven POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<!-- take the stuff from a "prod" or "non-prod" subdirectory and copy it one level up -->
<directory>src/main/webapp/js/${profile.name}</directory>
<targetPath>js</targetPath>
</resource>
<resource>
<!-- now don't deploy those profile-specific subdirectories -->
<directory>src/main/webapp/js</directory>
<excludes>
<exclude>prod</exclude>
<exclude>non-prod</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
This builds a perfect WAR file, which works fine when I deploy it some external Tomcat server. However, the problem is that Eclipse does NOT use that WAR file when running Tomcat inside of Eclipse. Instead, Eclipse works with an exploded version of the application, deployed to a cryptic directory like this:
<workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/MyApp
... and apparently the app's files are copied to this location PRIOR TO Maven doing the little trickery shown above. Therefore, when testing locally inside of Eclipse, no JavaScript include is present at all in the expected location.
Is there a way around this problem? Maybe an Eclipse change, or a Maven change, to pull the file from Maven's "target" directory to Eclipse's "wtpwebapps" directory? Maybe there's another approach to solving the profile-specific-include-file issue altogether?
Starting from eclipse (Helios) 3.6 , the option “Java EE Module Dependencies” is replaced by “Deployment Assembly” option . You can configure which files to be deployed to the tomcat running inside of Eclipse in this “Deployment Assembly” option (Project Properties ---> Deployment Assembly )
You could deploy to the local server using the maven-cargo-plugin instead of running from Eclipse directly. This would then use your maven generated war.
If the tests you are doing can be automated, this could then be incorporated as part of an integration test suite that would be completely run by maven.