How to construct an Eclipse instance for standalone (CI) execution? - eclipse

I need to use the p2 publishing tools from a headless build, and hence need, AFAICT, to assemble an Eclipse execution environment for that. I'm basing this on Running p2.process.artifacts in Jenkins, Running P2 Ant tasks outside Eclipse, and the related documentation.
But I can't find how to assemble the directory structure necessary to start Eclipse from. For instance, if I stupidly just run the launcher in any old directory as in:
java -jar <targetProductFolder>/plugins/org.eclipse.equinox.launcher_*.jar
-application org.eclipse.equinox.p2.publisher.UpdateSitePublisher ...
it won't run without access to all the required plugins, probably some config files, etc. How should these be assembled?
The context is a build environment, where all source and tooling (including whatever is needed for headless Eclipse) is checked out of repositories prior to the build.

Related

Is it possible to skip maven-javadoc-plugin execution in an Eclipse run configuration?

I have a few Maven projects in Eclipse 2019-6 that each include the maven-javadoc-plugin (v2.8) in their pom (which I don't want to modify), but in some cases I'd like to skip building the javadoc.jar when I run maven package or install through Eclipse (because for a couple of these projects, the javadoc.jar takes a fair amount of time to build).
Is there an argument I can pass through the Eclipse m2 run configuration that will allow me to skip the javadoc.jar when I run a package or install locally?
I've searched fair amount for tutorials or documentation of m2 run configurations in Eclipse and haven't found anything much more than "here's how to set up a Maven run configuration" with no extra options or advanced configurations.
I really appreciate any help!
You can try adding maven.javadoc.skip=true in the build parameters table of your launch configuration (equivalent to -Dmaven.javadoc.skip=true in a CLI build)

Start a Hadoop Map Reduce Job on a remote cluster in Eclipse with the run dialog (F11)

Is it possible to start a Map Reduce job on a remote cluster with the Eclipse Run Dialog (F11)?
Currently I have to run it with the External Tool Chain Dialog and Maven.
Note: To execute it on a local cluster is no big deal with the Run Dialog. But for a remote connection it's mandatory to have a compiled JAR. Otherwise you get a ClassNotFoundException (also if Jar-By-Class is set)
Our current Setup is:
Spring-Data-Hadoop 1.0.0
STS - Springsource Toolsuite
Maven
CDH4
This we set on our applicationContext.xml (this is what you specify in the *-site.xml on a vanilla hadoop)
<hdp:configuration id="hadoopConfiguration">
fs.defaultFS=hdfs://carolin.ixcloud.net:8020
mapred.job.tracker=michaela.ixcloud.net:8021
</hdp:configuration>
Is there a way to tell Eclipse it should build a JAR when the Run Dialog is executed.
I do not know if it builds a new jar (may be you must extract a jar to a folder), adding "Run Configurations->Classpath" your jar clears the problem "ClassNotFoundException".

Force Eclipse to clean a project automatically before every run

I'm looking for a solution that will force Eclipse to automatically clean a project before I run it (I'm talking about running a project using just Eclipse- no Maven, no Ant). For building I already have a Maven configuration, but sometimes I run the build directly from Eclipse as well and this is when I need that cleaning.
Shouldn't it be possible to have Maven and Eclipse use different class folders, e.g. /target for the Maven build and /bin for the Eclipse internal Java compiler? If so, you should be able to have 2 different launch configurations running the code from 2 different locations.
Second alternative: You can create a small Ant script to clear the target directory. That Ant script can be run from inside Eclipse, so a workaround is running the Ant launch configuration first and your Java launch configuration afterwards. To make this a one-step process, please install the launch groups feature from Eclipse CDT (you only need that small feature, not the whole CDT!), then you can create a "batch" like launch configuration from the other two launch configurations. Now everything is inside Eclipse with a single launch configuration!

Launch an Eclipse Run Configuration from ANT

I am using Orion server for my Java-based web application. I have a run configuration that launches Orion with the correct classpaths and all necessary configuration. I also have several ANT scripts for copying files to the build path. I want to create an ANT script that shuts down Orion, copies necessary files, and restarts Orion. I can shutdown and copy in ANT, but I can't figure out how to launch a run configuration. I prefer to reference the launch configuration as opposed to specifying all of the configurations in the ANT script as well. Is this possible?
With eclipse remote control you can launch eclipse run configurations in eclipse from a simple java client application.
Ant4Eclipse is an Eclipse plugin and looks like it can do what you are asking. I have never used it myself so can't guarantee but reading their documentation they say you can create an Executor task that works on your launch configuration artifact. You will then reference this task in your build file.

How to solve problem with out of synchronization of J2EE module dependency in Eclipse?

I have two projects : my-lib and my-web.
my-lib is built using the Java compiler of Eclipse, and a short Ant task is run on some properties files, which are then modified (as explained here).
This is not a pretty solution, but it works.
Now, as my-web is dependent of my-lib, I define my-lib as a Java EE Module Dependency of my-web.
However, when I attach my-web to the Tomcat in Eclipse, and try to publish, I get the following exception:
'Publishing to Tomcat at localhost' has encountered a problem.
Resource is out of sync with the file system: '/my-lib/target/classes/my-app.properties'
This file is indeed one of the files modified by the Ant task.
How can I correct this problem, as I need to have the Ant task run on the my-lib.
If you have the Ant task run as an external builder or external task, you can configure it to refresh the project, workspace, or selected resources after execution. When specifying the task/builder click on the Refresh tab and pick the appropriate one for your needs.
There's more information in the eclipse help.