Alfresco configurations - eclipse

Is there a way to automatically refresh the changes I made in my java classes once I ran my alfresco repository in eclipse ?
Because it is very time consuming to stop my tomcat, make changes in my classes and re run it then test the changes I made.
Is there a way to configure it ?

Yes there is way, If you are using SDK 3.0 you need to configura hotswap agent.
Below link will help you in that.
https://docs.alfresco.com/community/tasks/sdk-hot-reload-hotswap.html
You can configure hotswap agent in eclipse also.same add same configuration in eclipse (Run Configuration->Maven Build->New Build)
add goals as clean install alfresco:run
In jre tab add this configuration In VM arguments field ==> -javaagent:[path]hotswap-agent.jar
Run it.
In case of SDK 2.0 you need to use spring-loaded jar instead of hotswap agent.Configuration steps are almost same except the goals.

Related

best way to enable hot deployment on Jetty when using Gradle+Eclipse

I'm used to mvn, but I'm testing Gradle (v1.8) for a small web development project.
I've noticed that the Jetty Gradle plugin support autoscan and hot deployment, so I've enabled it. My goal is to recompile from Eclipse and get a Jetty reload the context every time I change a Controller, etc.
However, this is non working, mainly because Gradle compilation output goes to build/, however the Gradle Eclipse plugin creates a .classpath configuration that directs all the Eclipse output to /bin (even mixing test and main source folders).
Is there a way to?...
Run graddle jettyRun on a separate console.
Save a modified class on Eclipse (triggering a compilation)
See that Jetty picks up the change and reloads the context.
As per my research, I've identified three workarounds, but none of them solves the question above (I'm posting them in case you have related comments or more recommendations)
Tweak Gradle Eclipse config to direct test and main build output to the same directory that Gradle uses (using the pattern seen here). This is not recommended by some people, as it means using two different compilation systems that could interfere with each other.
Use the Gradle eclipse-wtp plugin to generate a WTP2 config, and use Eclipse's "Run AS -> Run on Server". This accomplishes the hot deployment / iterative goal and keeps both systems (IDE and Gradle) isolated. However, you need to setup the server on Eclipse.
(Not really a workaround): I've tested Spring's Eclipse build (STS) Gradle integration, however it seems that the integration is focused on the project setup, and while Gradle builds can be automatically triggered, Eclipse compilation is still redirected to bin/.
So you are interested in fine-tuning hot-deployment, right?
Please, consider using Gretty gradle plugin: https://github.com/akhikhl/gretty
It is an advanced gradle plugin for running web-apps on jetty. It does exactly what you want, regarding hot-deployment (and, possibly, even more).
Disclosure: I am author of Gretty plugin.
If you don't want to change to other plugins, here are two steps for the workaround:
add below configurations into your build.gradle:
jettyRun {
reload = "automatic"
scanIntervalSeconds = 1
}
each time after you changed java code, run the following task:
gradle compileJava
Because jetty is watching the *.class files, it will hot reload only after *.class files changed.
Refer to this link: https://discuss.gradle.org/t/hot-deploy-with-jetty-plugins-jettyrun/7416

Google App Engine, Maven and Eclipse development setup

I'll try keep this short. I have Eclipse with an installed M2E (Maven to Eclipse) plugin. I have a GAE (Google App Engine) project I'm working on. Everything is working ok apart from one really annoying thing: I have to stop/start the devserver every time I make a change.
If you have any experience with this setup then you might be able to answer this simple question?
I start the development server with "mvn appegnine:devserver" on the command line. Now I would expect that if I made changes to a *.jsp for example that those changes would automatically be updated on the devserver. Is this what happens with you?
I have noticed that if I make changes to *.jsp files under my target folder then devserver will see those changes and updates as I would expect. I think my problem lies with Eclipse not copying changes to target folder, but not sure if is even suppose to?
Does anyone have any suggestions on how I should progress investigating this? I've ran out of ideas :-/
I thank you in advance for any comments you may have.
P.s I know I can run "mvn package" to update files, but this is slow and the devserver runs out of memory after a do it twice.
This can be little painful, depending on how you want to work and which version of eclipse you're using.
Install the m2e-wtp plugin if you haven't. It's the secret sauce that makes appengine projects work in eclipse. Note this isn't m2e - but another plugin.
Install the GPE - the google plugin for eclipse if you haven't
Make sure your project is being managed by m2e as a maven project.
Go into your project properties - enable it as an appengine project using the GPE (listed under 'Google'). Don't forget to tick HRD while you're here.
Go to your project build path (Properties -> Java Build Path).
Ensure on the source tab that your src/main/resources doesnt have an ** exclusion.
Ensure on the libraries tab your have the three libraries 'JDK', 'Google Appengine' and 'Maven Dependencies' and nothing else
Ensure on the order and export tab that the appengine dependencies are above the maven dependencies.
It sounds pretty ridiculous - i'm not really sure why its still so painful, but that is a good recipe for success. Once that's done, this should allow you to run in debug from eclipse itself, with hotloading of code, jsps, css, scripts etc. I've had this work in helios, indigo and juno.
You can read more about the m2e-wtp setup instructions here. They refer to GWT but it's the same for appengine (I'm not sure why the emphasis on using GWT on GAE) because its actually about the correct setup of GPE and Maven.
You will also find that you may need to repeat some parts of step 5 pretty frequently - if your app isn't loading properly take a quick look to ensure that your resources haven't been excluded. This happens when you update your project configuration using the m2e plugin.
The wtp-m2e plugin updates the target folder as resources modified - so this should also resolve your issues running from the command line, but i can't vouch for that - I prefer to run straight out of eclipse.
I have the same problem as you, however I resolved with other way. I use FileSync plugin (which can be found in the market place).
With this plugin you configure an input directory (webapp) and output directory (target).
Any change made to the webapp will be passed to the target.
I have helped too.
You can use rsync like this:
rsync -r --existing src/main/webapp/ target/ROOT
where "ROOT" is the project build finalName.
The below point worked for me.
Ensure on the order and export tab that the appengine dependencies are above the maven dependencies.

Disable refresh of target on build

I'm using tycho to build my rcp application. Sadly, today I have to release the first internal milestone, but one of the projects I'm using is down (The great LWJGL - http://www.lwjgl.org/) and consequently my build fails because I cannot resolve an entry of my target platform.
Does there is a way to disable such update?
Note that I already have build my app, hence I already have downloaded all the LWJGL's jars and p2 stuff. Now I simply want to use the version of LWJGL I already have to build my RCP application...
There is a corresponding Eclipse p2 bug that needs update site checking for the target platform - that's why maven offline mode does not work as expected. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=337022
For later, I suggest building a mirror of critical outside sites. In that case you could at least redirect the build to that. E.g. b3 aggregator can be used for this: http://www.eclipse.org/modeling/emft/b3/
try maven offline mode (mvn -o)

Java maven development slow

I am developing a war/java website that is built via maven.
Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.
This is becoming very frustrating, so I have tried to speed up the deployment. I deployed the site via maven with war:exploded. Now, I edit the files live in 'deployed' format. The problem being I will need to move these changes back to the source location for pushing into our source control.
So has anyone written a script to 'undeploy' changes on the server carefully pointing them back to where maven expects them to be, or found another way I can instantly see my changes in a web browser. Rebuilding from source everytime is not a fun solution.
Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.
This is just a wrong way to use Maven in my opinion.
Either use something light like jetty:run (and hook Eclipse remote debugger to enable hotswap), see Configuring Jetty, Maven, and Eclipse together with Hot Swap.
Or use Eclipse WTP and deploy your project on a Tomcat server inside Eclipse (your project can be recognized as a Dynamic Web project whether you're using m2eclipse or the Maven Eclipse plugin).
Have you tried JavaRebel?
http://www.zeroturnaround.com/jrebel/
Use hot-deployment.
Just configure tomcat-maven-plugin and try tomcat:redeploy.

Using customBuildCallbacks.xml in an Eclipse RCP headless build

I am trying to add some custom build steps to my headless build process for an Eclipse RCP application.
I understand that the recommended way is to provide a customBuildCallbacks.xml file on the plug-in directory, and adding a link to it in the build.properties file.
# This property sets the location of the customb Build callback
customBuildCallbacks = customBuildCallbacks.xml
However, during the build process, this step is ignored.
Is there some set-up step I might be missing?
Actually, I found out that this is the only thing required.... if we are using eclipse 3.3. This will not work using Eclipse 3.1