I have 2 Projects i.e Project A.war and Project B.jar .
Project B is added as a dependency in project A.
Currenctly Project B has some scripts in particular folder structure. I include these scripts in Project B.jar using maven includes.
I want to copy these files in Project A.war in another folder structure.
Is this correct way to do or can it be done in better way.
My final aim is to copy the scripts from Project B to Project A.war in differenct folder stucture.
Related
I want to have my jar file not only in my build/libs folder, but also somewhere else on my system. On maven, I just needed to copy and paste the entire section in my pom.xml and change the directory from there. Is there something similar in gradle?
This is how I am building my projects:
Open your Project Structure (right-click on your project directory in IntelliJ, and select open module settings) -> Artifacts -> Here you can change you're jar-output directory
...and also add new jar output directories
To change your out-directory path select Project Structure -> Modules -> Paths, and change output path
Previously we made a Gradle project in Intellij and all the gradle files were there under the project. However, we have now moved the files in this project to a sub folder, but the Gradle files aren't being recognised. The picture below is the new folder set up where our code from the original project is now in the server folder (where the Gradle files are). When I mark the src folder (under server) as the Sources Root, that is when the dependencies from Gradle aren't recognised.
I figured out that the correct way to go is actually to separate out the client/server folder into two separate modules.
I have checked in one of my projects to GIT repo. When i cloned it from GIT, imported the project to eclipse and converted the project to Maven Project, the folder structure of maven seems to be a bit different
This should have been src/main/java, src/test/java, src/test/respurces folder structures and com.vod... as package.
I have tried maven>update project, project>clean, maven>clean, eclipse::clean, eclipse::eclipse. But this project structure does not seem to go off.
Any possible solutions for this please?
After importing the project as eclipse general project, below is the structure.
This is a typical problem due to the lack of Eclipse metadata files in the GIT repository.
How to solve it:
Open the project's contextual menu > Java Build Path > Configure Build Path > Source. Drop off folder src and set as folder sources just these:
src\main\java
src\main\resources
src\test\java
src\test\resources
This will save some metadata to the .classpath file.
Also, you should ensure that this was set as a Maven project: Open the project's contextual menu > Configure. If there is the Convert to Maven command, execute it (if not, it is already a Maven project). This might save some metadata to the .project file.
Then, be sure to check in the Eclipse metadata files (.classpath, .project and .settings folder) to GIT. And, in order for this project can be safely shared to other developers, be sure not to enter absolute paths in the java build path, nor other system-dependant constraints.
I have two (Java) projects, a library and an executable which uses the library. The two projects reside in subfolders of the same folder but I don't want to add anything (like settings.gradle) in the root folder (they come from different git repositories, thus, I cannot have the files in the common parent source controlled). Here is my layout:
lib - has some runtime dependencies (from the maven repo)
app - depends on lib and has some (different) runtime dependencies
The goal is to produce a folder (Gradle's build\libs is good enough), containing a jar file and a lib subfolder with all runtime dependencies. What is the best approach with Gradle? Here is the result I am looking for:
app\
build\
libs\
app.jar
lib\ - all dependencies are here
With ant for instance, I bring everything together when building the executable (referencing the lib's source code via ../lib/). That's somewhat ugly, but get's the job done. Ideally, I would think that it's more flexible to have the lib build as a dependency, when building the executable, just adding another jar to the app's lib subfolder.
Thanks in advance
You can put your root build.gradle file and the settings.gradle file in a folder named master next to your lib and app folder:
lib - has some runtime dependencies (from the maven repo)
app - depends on lib and has some (different) runtime dependencies
master - root build.gradle file + settings.gradle file
gradle looks for a master folder when searching for a settings.gradle file
I have an existing library that I am building in Eclipse and have added the Maven nature to my project using m2e to add dependencies. When I convert it to a Maven project, my existing source directory (and my bin) become normal folders. Is there a reason for this? I am new to Maven, so I am likely doing something wrong, just not sure what...
My project structure is as follows:
workspace
project
src (in build path)
resources (in build path)
bin (output dir)
I tried both "mvn eclipse:eclipse" and right click on project -> Configure -> Convert to Maven Project, and both removed my src and resources folders from my build path, and after changing the structure to the below, changed the output to target/test-cases. Even if I manually adjust the build path and output, my dependencies don't resolve.
workspace
project
src (no longer in build path)
resources (no longer in build path)
bin (no longer output)
target (new output dir)
test-cases (empty)
I think you have the following structure when working with Eclipse (without Maven):
/workspace
/project1
.project
/src
/bin
But Maven want to use the following structure
/workspace
/project1
.project
pom.xml
/src
/main
/java
/resources
/test
/java
/target
/classes
/test-classes
and so on. So it is normal, that the folder src is no more directly a source folder for Eclipse, but now there are src/main/java, src/main/resources, ...
So it would be easier in the beginning to start with a new Maven project, and move your original sources to the directories they should belong to. Maven has a long tradition with its "convention over configuration", to deviate from that is possible. Have a look at the answer to "Handling unconventional source directory ..." to fix this.