Location for 3rd party component that will be used during the build (gradle) - gradle

We have one project that reuses 3rd party war (it's shindig-server-2.0.2.war if anyone asks:). This war currently sits in project root and the current ant tasks unzips it into some temp folder, performs several changes (like applying fixes, modifies the web.xml etc.) and finally build the war from our sources and the war content. This 3rd party is checked into the source repo.
We are migrating to gradle. Where should we put this file in Maven directory structure?
It does not look it belongs to /src/main/resources as it is not packed withing the artifcat; also, imho it does not belong to /src, too. Should we have a /lib/resources folder in root where we could store such files?

I don't think the Maven directory structure defines a place for local dependencies, and since this is a Gradle build, it doesn't really matter either. I wouldn't put it under src, but lib sounds fine.

Related

Which project files contain information that this is a maven project

There is a project on Spring. If I clone it from GitHub, then open it in IDEA, then it understands that this is a maven project, i.e. it highlights all the project folders with the right color - java, resources, etc. And if I just copy the source files of the project to another directory with all the folders, then IDEA does not perceive it as a maven project, but simply as a set of folders.
But on Github I don't see any other files except the source. And then where is all this information about the structure of the project stored?
That is, what files do I still need to copy so that the IDE recreates the entire folder structure as in the original project?
Usually, if it is a maven project, we use a pom.xml file. In case of gradle, we use build.gradle file.
Whenever a spring project is build, it reads one these files to get all dependancies.

How can I exclude artifacts by packaging in maven-dependency-plugin:copy-dependencies

I'm working in a complex tomcat configuration where I'm using third party proprietary service that is distributed as WARs. In the servlet container I have 10 WARs deployed where only one is coded by us.
We are using maven to manage the project.
I'm declaring the third party WAR files in the POM with provided scope.
My issue comes when I try to use maven to deploy the system in a local testing server.
I'm using maven-dependency-plugin:copy-dependencies goal to copy the right artifacts in the right directories in the local serving tester.
I must copy JAR files in one directory and WAR files to a different directory. But maven is not differentiating the artifacts by packaging. So I end having the JARs mixed with the WARs in the destination directory. While I need to have two executions, one for WARs and one for JARs going to the right directory.
I have only being able to use a copy goal specifying every artifact to copy, but this is difficult to maintain if any developer adds a new dependency, the dependency must also be added to the right copy goal.
I will like to be able to use copy-dependencies goal but being able to indicate that I only want to copy a specific packaging.
Any idea on how I can manage to do that?
Thanks!
You can use -DexcludeTypes=war
https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#excludeTypes

How can I get only the JAR file?

I had two projects using the same code for a functionality. To avoid that, I isolated this code in a new project so the two projects can use this functionality by indicating the dependency in their pom.xml file. So, once that I created the new project with the repeated, I save in innersource as a maven repository.
In the pom.xml file of both projects I used tag with and inside to indicate where is the repository. When I update the projects the dependency is downloaded from the remote repository and it works, but when I saw the Maven dependencies section of my project, where all needed JARs are, I found that is not only downloaded the JAR file of the third project, but there is a folder with the project.
So how I can get the JAR and not a folder?
Thank you so much for your help!

How to convert alfresco ant based project in alfresco5 maven based?

I am using alfresco 4.1.3 having following project structure.
I am using the ant script to build project.
Now I want to convert this project into maven based alfresco5.
I have configured alfresco5 using all-in-one archetype and I am able to run it successfully. My questions are:
How can I convert my alfresco ant based project in alfresco5 maven based?
Do I need to add src files in repo or repo-amp?
Do I need to copy all share related files in share or share-amp?
Any help would be greatly appreciated!!!
Thanks in Advance.!!
That totally depends on the ant build setup. But one good guess is that you will have to put the files residing in the "Alfresco" folder of your old project into different subfolders of the repo-amp, and the same way around with the "Share" folder. Most files will go into those folders, you have to study the SDK-docs carefully to know into which folders the files will go. Depending of the nature of your extensions some files could go into the Share and Alfresco war-structure as well (additions to web.xml for example).
There are no "Swiss army knife" for that works for all cases here.
Good luck
Do the following things:
Create new project as maven project and provide group id (it's yours) artifact id as alfresco5 and version (ex:43.0.1-SNAPSHOT)
With this it creates maven based folder structure
src/main/java -> replace it with your src folder
3.src/main/resources ->add your Share, reference and Alfresco folders.
look at you lib directory..what ever .jar will be there you need to define it in dependencies under pom.xml
compile the whole project..if there are compilation errors then add required dependencies in pom.xml

Configure Maven to have two output artifacts OR extract specific folder from JAR during web-application assembly

I'm migrating existing build system from Ant to Maven, and so far I've solved (or redesigned) many issues, except for this one.
Target of each our system-specific project is a simple JAR, but it additionally contains some project configuration and customizaton information which is copied to a (let's say) /product folder of a WAR. This way modularity and extensibility of our web-application is achieved
Consider example:
project:
MyProject
/product
product.info
some.data
WAR:
./product
/MyProject
product.info
some.data
..
..
./WEB-INF/
/lib
MyProject.jar
..
My question is: how do I achieve this result for our product-specific projects? The first thing that comes up my mind is: two artifacts as a result of such project build (JAR and ZIP), where ZIP is created by a POM in /product folder (and the best layout would probably be splitting each project into two sub-projects so that I can aggregate POM and ZIP with one multi-module project). I will appreciate all solutions proposed (incl. project folders' restructuring options).
The first and obvious answer is splitting up each such 'product' project (consider it as a 'module' if it's easier to perceive this way) into two sub-projects -- one for JAR, and one for configuration data. Then, using an assembly, all declared 'product-ZIPs' will go to ./product folder of a WAR.
EDIT Classifiers could also be applied to configuration-plugins in order to make assemblies more structured and easier to implement.

Resources