Gradle War Plugin: creates an intermediate directory in project root - java

I have a Gradle project, which produces a .war file at the end of the build. It works great, except for one thing.
While building, the plugin creates a directory in the project root folder called war, which contains basically the exploded version of the end result.
I wouldn't be bothered by it, if it wasn't in my build directory, because this way, it looks awful and also, IntelliJ picks it up as a Web root, which is annoying.
In the documentation I think I found the output property, which seems like the one telling me where this folder is. The problem is that it's read-only, so I can't rewrite it to my liking.
Is there a way to put this directory elsewhere?
Here is a link to my build.gradle file

It turns out, that I falsely accused the Gradle War Plugin with creating that folder. In fact, it was the Gradle Gwt plugin

Related

Deploy gradle to directory

This may have been asked to death, but I can't find an answer. I have a pretty simple java project (not web), its built with ant with sources located in ./src and dependencies in ./lib. Looking to modernize it to either maven or gradle. Since I've had good results with gradle and android, decided to go with gradle. That means I'll be dropping ./lib for dependency management.
However, I cannot figure out how to use grade to deploy the project. I would like to deploy manually for now. So I would need to have jar build from the sources and having all dependencies copied into lib (or whatever) directory where jar is.
So far... I'm getting nowhere quickly.
Gradle Application plugin is perfectly suited for this use-case.
the task distZip will create a deployable zip file complete with dependencies.

Where to put extension dependencies in neo4j 3

Where should I be putting the plugin dependencies in neo4j 3 (not the actual plugin jars).
In neo4j 2 there was a lib folder where the system would load the jars from but this no longer exists.
I've tried putting them in the plugin folder but then it requires me to add every dependency of the jars which becomes unmanageable and it also seems weird to have them there.
I've tried putting them in the neo4j bin directory but they aren't detected.
I've tried adding a command line argument to the vmoptions file with a wildcard pointing to a lib folder I created and this didn't work either.
Use maven shade plugin to package all the dependencies (except that one with scope test or provided) in the jar.
I think the documentation has just been updated (although I may have missed it). It says
Having built your code, the resulting jar file (and any custom dependencies) should be placed in the $NEO4J_SERVER_HOME/plugins directory. We also need to tell Neo4j where to look for the extension by adding some configuration in neo4j.conf:
So it turns out they should go in the plugins folder or you do as Daniela said and build a fat jar.
EDIT: I eventually came to the conclusion for several reasons including this one to use the server edition which has the same directory structure as the version 2.x.

Adding plain Java project as a classpath to an eclipse plugin

I have a plain Java project (not a plugin project) which I want to add to a classpath of a eclipse plugin which I am developing. But in web projects I can add that project as a build path and it works fine. But I tried same thing in eclipse plugin, I am able to compile successfully, but at run time I am getting java.lang.ClassNotFoundException.
I know OSGi quite well and I know how to add OSGi into an classpath (using export-packages) but what I want is to add Standard, non-osgi project into an classpath, so that I wont' get runtime errors. Is there anyway I can achieve this?
I can export project as a jar file or make it as a plugin project and it would work fine. But that's not my option currently because, still that API is in pre-alpha stage, and there would be lot of changes going on. So I am trying to avoid pain of exporting it as jar file everytime. Is there any option for me other than this?
I have a similar situation: I want non-OSGi Maven dependencies integrated into the classpath of my plugin. I succeeded with a roundabout solution, which I think is the best I could get.
I have a build step outside of Eclipse where I copy the class files of the dependency into the plugin's lib folder. The lib folder is specified in MANIFEST.MF as an entry in Bundle-ClassPath and (here comes the hack) as a source folder in build.properties. That was the only way to make the plugin work both when launched from within Eclipse and when exported.

Change output folder for Android R.java in Eclipse when using Maven

I have an android project setup using the maven-android plugin. This plugin adheres to maven output folders for the location of the R.java file (i.e. target/generated-sources/r).
However, when using this project in Eclipse, I can't configure aapt to rely on that folder.
Even if I manually go into the project properties and set up the folders manually, the ADT plugin goes in and resets just some of the settings (i.e. adds the /gen folder back as a source folder, and restores the output folder to /bin/classes instead of /target/classes), while leaving the maven /target/generated-sources/r folder and breaking the build of the project.
I would like to use the default Maven folder structure with the Eclipse ADT. Any ideas on how I can do this?
Thanks
Responding to the comments:
Yes, am using the m2e-android plugin.
Because ADT is still generating R.java in /gen, Eclipse is failing to compile if there still exists an R.java under target/generated-sources/r due to duplicated class definitions.
Unfortunately, the Android Connector for M2E does not support moving generated folders like the ADT gen folder to other directories. This is a restriction of the ADT, although there is a ticket to explore a way around this restriction:
https://github.com/rgladwell/m2e-android/issues/68
If you'd like to stay updated, please comment on this ticket.
This seems to be working for me:
Let the ADT keep gen as a source folder, but change the output folder for that source folder to be /target/classes.
I can build in both eclipse and using maven from the command line, and I don't get duplicate R class problems in either case. Essentially, Eclipse generates the R.java file in /gen, while maven generates it in /target/generated-sources/r, but both builds put the R.class file under /target/classes.
Note: at one point I had added /gen as an additional source directory in my pom.xml using build-helper-maven-plugin, and I had to remove that.

Eclipse makes incremental build do not using pom file properly

I have quite non-standard web app configuration: my web.xml file is located not in the WEB-INF folder, but is copied by maven from some another place (please don't ask why).
For that I'm using maven-war-plugin approach in my pom.xml: <webXml>${project.some.webapp.path}/web.xml</webXml>
It works fine when I call mvn install.
But, when I make 'Build project' (incremental build) in eclipse - it doesn't copy web.xml into the WEB-INF folder, as well as other maven-war-plugin features, like webResources. (it seems its just doesn't use its configuration at all during the incr build)
What can you advice in my case?
There's currently no option for this (I'm looking for one right now). In fact, it would work if there was an option in Eclipse to always run a full build (that's what you do when invoking «Build project») instead of an auto-build that runs an incremental-build, which only look at resources directory (by doing a delta). So many actions are not performed, such as copy-resources and so on, even if you've set up other directories, maven doesn't look into these because of the ignoreDelta incremental option.
I'm looking for a way to force the full build in every case, but it may need to change the core code of Eclipse.

Categories

Resources