How to fetch the latest released version of a dependency included in my pom.xml - maven-3

Instead of manually changing the version each time, i want the maven to load the released jar version automatically.
I'm using Eclipse with embedded Maven version 3.5.4
Could you anyone suggest on how to resolve this ?
I have tried LATEST and RELEASE keywords in
LATEST
But it does not work.
If i use version range like
[1.70.4,) it loads the snapshot version which i do NOT want
i have added the below mentioned dependency in my pom.xml
<dependency>
<groupId>com.xxx.portal</groupId>
<artifactId>portal-xxx-integrationtests</artifactId>
<version>1.70.4</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Related

Maven how to exclude jar files in war but need it for the build

I am new to maven.
I am using maven 3.6.2
I am using jdk 1.7.
Any help or hint would be greatly appreciated it!!
I have a dependency in pom.xml:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</catalina>
<version>7.0.12</version>
</dependency>
I need the above dependency to do a build:
dos-prompt>mvn clean install
But when use it in a tomcat 7 I need to exclude the above jar file in the war file that is the result of the build.

What to modify when upgrading Struts from 2.0 to 2.5?

I have a big project running on Eclipse that uses Struts, I want to upgrade Struts from 2.0.11.1 to 2.5.3.
However, I checked the Migration Guide but there was no info detailing what should really be removed, updated, added, etc..
I downloaded struts 2.5.3 and there are a lot of libraries, plugins, source files, etc..
My question is that can I upgrade Struts from 2.0.11.1 to 2.5.3 directly?
If yes, then what should be changed and how will this be done?
If no, kindly propose a solution.
When you upgrade the version of Struts2, you have to update the libraries requires by your application to the target version. Each Struts2 release is supplied with the corresponding set of libraries in the lib folder that are compatible with the version of Struts. If you use maven to resolve and fetch the dependencies you should consider the artifact struts2-core.
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.3</version>
</dependency>
It will fetch all required dependencies for this artifact, other dependencies, such as plugins you need to add separately. Use the same version targeted to plugins. For example to add a convention plugin use
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.5.3</version>
</dependency>
The targeted version number is 2.5.3, but it's possibly incompatible with the other features i.e. Hibernate and Spring which versions need to upgrade separately by adding corresponding artifacts to the dependencies.
And finally and most time consuming are changes to the source code of the project, update the configuration files according to newer DTDs, API changes, fix deprecations. For this purpose consider reading the release notes.
You can't upgrade Struts2 just changing the major version number.
Also see the example of developing a maven project: Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application.

Show Vaadin Framework Version

Having installed Vaadin as an Eclipse Plugin several months ago, how do I find out which version of the Vaadin Framework is currently installed on my machine?
First of all we need to differentiate between the 2 key concepts at hand:
Vaadin framework: a set of libraries (or dependencies, or jars) that are used to develop rich internet applications. They'll be packaged with your application and deployed in a web server
Vaadin Eclipse plugin: a utility designed specifically for Eclipse to help you develop using the Vaadin framework
So, while it is true that the plugin can help you get started with developing a Vaadin application, eg creating a maven project from a prototype, it has almost nothing to do with the Vaadin version (almost because probably a certain version of the plugin will be compatible with a limited range of framework versions).
On the other hand, each project that uses the Vaadin framework, will include these dependencies somehow.
if you chose to manually download the zipped files and place the jars in your project, they should contain the version in their name eg vaadin-server-8.0.6.jar. And even if they've been renamed, you can open the jar (they're just zip files) and inside the META-INF folder you'll see a MANIFEST.MF file which you can open with your favourite text editor and check the version, eg:
if you're using some dependency management mechanism such as maven (or ivy, gradle, etc) then you can look in the specific build file for the referenced version, eg:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>8.0.6</version>
</dependency>
In conclusion, a Vaadin version is not exactly installed on your PC (you can have multiple versions downloaded in your local maven repo), but rather a certain version is used in a project, and you should look inside that project to figure out which one exactly is being used.

Maven versions plugin: updating plugins

I'm seeing some updates when I run the versions:display-plugin-updates but I found no way for the plugin to fix those. Am I just missing something?
Here's the output:
The following plugin updates are available:
maven-checkstyle-plugin ................................ 2.16 -> 2.17
maven-release-plugin ................................. 2.5.2 -> 2.5.3
maven-surefire-report-plugin ......................... 2.18.1 -> 2.19
org.codehaus.mojo:findbugs-maven-plugin .............. 3.0.2 -> 3.0.3
The following plugins do not have their version specified:
maven-clean-plugin ........................ (from super-pom) 3.0.0
maven-deploy-plugin ....................... (from super-pom) 2.8.2
maven-install-plugin ...................... (from super-pom) 2.5.2
Project defines minimum Maven version as: 3.0.4
Plugins require minimum Maven version of: 3.0.4
Note: the super-pom from Maven 3.0.5 defines some of the plugin
versions and may be influencing the plugins required minimum Maven
version.
No plugins require a newer version of Maven than specified by the pom.
Require Maven 3.1 to use the following plugin updates:
org.bsc.maven:maven-processor-plugin .................... 3.1.0-beta1
Is there a goal to update those plugins and/or add the ones not defined?
The short answer is that you need to update the versions in your pom.xml by hand.
It's not particularly onerous as it is not something that needs to be done frequently.
There is a workaround: Define plugin versions as properties, then the goal update-properties updates these versions as well.

maven 3 - Why is my compiler plugin out of date?

I downloaded the latest version of Maven from their site and am using it in Eclipse. But it seems my maven-compiler-plugin is out of date ie. version 3.1 while according to this page the most recent version is 3.3. First of all if I am using the latest version of maven why do I have to use an outdated plugin ? Secondly why is it out of date ? I looked up the Super-POM and nothing about the compiler plugin was referenced there.

Resources