When is it a maven project? - spring

When I download the .zip-file from start.spring.io, I download a maven-project, right?
Is it a maven-project, as soon as I use maven to manage my dependencies? Or is a maven-project something seperate, which I include into my project?

You have two possibilities:
1. To download a Maven Project from start.spring.io using Spring Initialzr.
2. To download a Gradle Project from start.spring.io using Spring Initialzr.
The project that you download from start.spring.io, in your case it's a Maven Project with all the selected dependencies already. You can recognize a Maven Project about pom.xml file where all the dependencies are included. So, all you must do after downloading the zip file from start.spring.io is to unzip the archive and after that to import the maven project (chosing the pom.xml file) in you IDE.

Related

How to add a Dependency via Maven for an Eclipse Plug-In Project

I'm working on a Xtext/Xtend based plugin for Eclipse. My project structure contains of various Plug-In projects. The project was created as a maven project and converted to an Xtend project. Developing and building works fine but now I'm at a point where I want to add a dependency (org.apache.poi) to one of the plug-in projects.
I added the <dependency> node from maven central to my pom.xml in the parent project and it got downloaded to my local maven repo. So far so good but when I try to import org.apache.poi.xssf.usermodel.XSSFWorkbook in one of the (child) plug-in projects it can't be resolved.
When using maven in a plain Xtend project I have no problems using it. After adding the <dependency> to my pom.xml I'm able to use it afterwards. So I guess the problem lies in the fact, that I'm now dealing with a plug-in project. At the plain Xtend project, for example, I have a "Maven Dependencies" classpath container which I don't have in my plug-in project.
What I've tried so far:
added the <dependency> to the pom.xml in my parent and/or the child plug-in project where I want to use it
added the dependency via Eclipse GUI (opened pom.xml -> Add Dependency)
added the dependency via right MB on plug-in project -> maven -> Add Dependency
Maven Update Project
clean install -U after adding the dependency
clean/build project
In the MANIFEST.MF I can't add the dependency as it is not shown in the list of dependencies to choose.
What's the way of adding maven dependencies to a plug-in project in Eclipse?

How does a jar pull transitive dependencies in Maven?

I am buliding small Spring Boot app - pacakged as jar file (I'm using maven plugins).
I know that there are solutions which allow me to build jar file with all desired dependecies (e.g. maven assembly plugin).
The question is what if I don't pack maven required depedencies using those solutions? Am I correct that I will always get "NoClassDefFoundError" ? So should I always pack my project with all depedencies into jar file or there is another solution to "makes thigns work"?

Suppress maven dependency version suffix in local repository

I have a Spring Boot project that uses SAP Crystal Reports. CR is not published in Maven Central. I imported all of the CR jar files into my Maven local repository. In my projects the jars have the version appended to the jar file name. For one jar file, this causes a runtime error. How can I have that jar not have the appended Maven version?
if you build from source using Maven then you can override the artifact final name in the POM of this project
<finalName>myJar</finalName>
If you run the mvn install manually then you have control of what you store into the Maven repository
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
This is my workaround hack.
The Jar is question is never directly referenced by my project code, it is a runtime library of the Crystal Reports java runtime. I do not need it in the classpath at build time, just in the deployed file built by maven.
My Spring Boot project is deployed as a WAR file so I need to structure my Eclipse Maven project so that the Jar is placed in WEB-INF/lib as a plain web app resource. I do not specify the jar as a maven dependency.
It's a hack because the jar file IS a dependency and SHOULD be specified as a maven project dependency in the pom.xml.
This solves my immediate problem.
I blame SAP for not considering Maven for their Crystal Reports Java runtime.

Update Maven Dependencies Jars

I am new to Maven and have a quick question. I am using the JBoss IDE and have my Maven project set up. I have several jar files in my Maven Dependencies build path that need to be updated to a newer version. I have tried adding the external jars manually, but they do not go within the Maven Dependencies library and the outdated jar remains within that library.
What is the best way to update the jars with the Maven Dependencies library?

Maven beginner question, get m2eclipse to download jar and add to build path?

From what I have read, after adding the relevant maven repositories, maven should automatically download the necessary jars to satisfy dependencies in the pom.xml file.
However, no jars ever get downloaded for me after I add dependencies in eclipse. Am I missing some glaringly obvious step?
I'd recommend to start from creating your project with m2eclipse. See more details in this article.
Basically, you need to make sure the following:
your Eclipse project has a valid pom.xml and all dependencies are available (you should see errors on Maven console, in the Problems or Markers view or when opening pom.xml in m2eclipse's POM editor)
Maven support is enabled for this project (you can use Maven / Enable Dependency Management from popup menu on that project)
project configuration is in sync with pom.xml (you can use Maven / Update Project Configuration from the project popup menu)
you can also use Maven / Update Dependencies to refresh your dependencies (e.g. when you got them in your Local Maven repo from the command line)
Dependencies jars aren't in your project but in your local maven repository.
These jars will be automatically used when you compile you project with maven (or m2eclipse).
If you don't have the needed jar yet, maven will download it for you.

Resources