How can I add multiple build paths for my jar file? - gradle

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

Related

settings.gradle file did not showing in Intellij

I create a gradle project in IntelliJ, but settings.gradle file did not showing in intellij and when I want to create it this message shows:
A file with name 'settings.gradle' already exists
when I look at my project in explorer I found settings.gradle there, but it is not showed in the Project view in IntelliJ.
I found the solution. If you have my problem, you should go to
File -> Setting -> Editor -> File Types
and delete what you want in "ignore files and folders" section.

Gradle files not recognised in new directory structure?

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.

Maven - Wrong folder structure

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.

dist and native-win could not be activated, no POM in directory

Please explain what is required to be done stepwise.
How to activate -dist and native-win?
I saw your error contains there is no pom in this directory.
Maven can run only from the location where pom file exists so make sure pom file is there in your project.
For example, your project is inside C:\Users\HP then so maven will consider HP as a project and it will try to find pom file inside HP project.
This error is coming because you didnot place hadoop source package in the C:/User/HP directory. you can download appropriate source package from http://www.apache.org/dist/hadoop/core/
unzip it and place all the files & folder in C:/User/HP then run your maven package command. It should work

M2E Removes My Source Directory?

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.

Resources