Unable to add Maven Dependencies into my Eclipse Web Deployment Assembly - java

trying to get onboard at new job. Guide says to add Maven Dependencies into the Deployment Assembly of the project. There should be an option to add java build paths when I press add but no such option appears. Because of this there no maven and i cant launch the local tomcat server. Is there another way to add the Maven Dependencies build path?
https://imgur.com/a/fbGnead

if I understand right you have a maven project?
If is that you must have pom.xml file in your root path project.
If you want to run your maven project:
mvn clean package
mvn install
mvn tomcat:run
If you want to import your maven project in Eclipse
mvn eclipse:eclipse
If doesn't work try with this solution from mkyong
https://www.mkyong.com/maven/no-more-mvn-eclipseeclipse-whats-next/
regards.

Related

Maven install fails after maven clean in eclipse

I have a maven project in Eclipse and I added some local jar files to the buildpath. If I do not add any dependency to the pom.xml file I am able to execute maven install. Then, if I add those dependencies to the pom the command maven install continues working as well. Now in this situation if I run maven clean then maven install fails. Why?
I also tried to run Maven -> Update Project but the result is the same. What is the problem?
If you are using non maven dependencies then it will fail to build eg from CLI and in your case in Elipse after cleaning the project as well. In order to make it work you have to installl tha JAR you are using as Maven artifact and the ninclude it in POM dependencies like every other library.
Here you have info on how to install 3rd party JARs to local repo
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
I got the same problem and resolved by adding the 3rd party in the pom.xml manually

Maven trying to download a local dependency

I'm working on an API that depends on a small library I created in my project. In IntelliJ IDEA, it looks like :
PROJECT : myProject
MODULE : mySimpleAPI (maven project + spring boot application)
MODULE : mySmallLib (maven project)
I just added mySmallLib in mySpringAPI's dependencies.
But when I execute the spring-boot:run command, it tried to download the dependency from spring repositories. I tried in offline mode, but it also didn't work. How can I tell to maven that the dependency is already in the project and it doesn't need to download it ?
run mvn clean install on "mySmallLib" project first. This will install the jar in your local maven repo. Then you can perform mvn spring-boot:run on "mySimpleAPI" project.
Seems your code/library is not updating automatically. So you will need to update them manually.
Go to each sub module of your project and open pom.xml. now right click on the file and click on clean install.
Try running your application again, and it should work. Let me know if it doesn't.

Maven dependencies not visible under Build path in Eclipse Luna

I'm using Eclipse Luna for my project. I've imported a Maven project into it. Right click->import->import existing maven projects. I made mvn clean package install under run configurations. It ran successfully till mid of project, and in the sub modules, it got failed due to some issue in Java file. But whatever the JAR's that have been fetched should be displayed under Maven dependencies under Build path right?
Here is the screenshot
Do I require to make any steps here?
Right click the project and Configure as Maven project

Errors after building project using maven

I followed the following tutorial (https://github.com/kolorobot/spring-mvc-quickstart-archetype) and imported the project to eclipse.
However, i am getting the following errors in my pom.xml file, and also in all the java classes.
I have attached the screenshot.
POM.xml
Java classes
I have updated my Post
PROBEM VIEW
In the eclipse buildpath, make sure you have the maven dependency jars downloaded under "Maven Dependencies"
If you dont see, run the below command to download the same.
mvn clean dependency:copy-dependencies package
This may sound silly, but in my experience I have seen this working. Do a Project Clean in eclipse and do a maven build
There is no Maven dependencies classfolder in your screenshot. Have you tried right-clicking the project name -> Maven -> Update Project?
Update Unbound classpath var.M2_REPO
You need to fix your Maven installation. Go to Window -> Preferences -> Maven and have a look at: Installations and UserSettings

How to stop eclipse to redownload the plugin from repository for a maven project

I am importing an existing project into my eclipse workspace. I am using Maven 2.2.0, and Eclipse Juno. I could build project successfully using mvn command prompt.
But unable to import the project as eclipse could not build the project.Eclipse is trying to again download from repository. What If we stop eclipse to download the resources again from repository.
I thought I would add Windows--->Preferences-->Maven--Archetype--Add local catalog
I understood that we have ~/.m2/archetype-catalog.xml catalogu file. But to my surprise I cannot find it.
Please suggest me if I am proceeding with correct way or not.
If its correct way, how do I set local archetype.
Please share your thoughts.
Thanks In Advance.
You need to install the mvn plugin and import the mvn project as such. Alternatively, you can eclipsify the mvn project using the goal eclipse:eclipse (with the mvn command line).
In mvn itself you could set the pluginRepo to updatePolicy NEVER temporarily, if you still have issues with Eclipse. I think Eclipse uses the same settings for importing mvn projects.
http://maven.apache.org/settings.html
I personally never was happy with Eclipse's mvn integration. Have you tried IntelliJ?

Categories

Resources