How to get notified about 3rd party library updates with Maven/Gradle? - maven

I would like to use the latest versions of 3rd party libraries I am using in my project without having to manually check for them or blindly downloading the latest version for the build. During some build phase I would like to receive a notification that a newer version of a dependency exist. Is there a way to do that with Maven/Gradle? Or may be there are better ways to get notified about newer dependency versions?

For maven, there's the maven-versions-plugin
For gradle, there's the gradle-versions-plugin

I don't think you want this check to be made with each and every build, as I'd expect it will slow it down pretty much (and also add extra strain on repositories; imagine what would mean if each and every build, ever, would hit the mvn repository, every time).
The closest I came to solving this problem was with versions Maven plugin; it appears it has a feature which allows you to see the newest updates (check this link).
This is how it looks like:
[INFO] ------------------------------------------------------------------------
[INFO] Building Build Helper Maven Plugin
[INFO] task-segment: [versions:display-dependency-updates]
[INFO] ------------------------------------------------------------------------
[INFO] [versions:display-dependency-updates]
[INFO]
[INFO] The following dependency updates are available:
[INFO] org.apache.maven:maven-artifact ........................ 2.0 -> 2.0.9
[INFO] org.apache.maven:maven-plugin-api ...................... 2.0 -> 2.0.9
[INFO] org.apache.maven:maven-project ....................... 2.0.2 -> 2.0.9
[INFO] org.codehaus.plexus:plexus-utils ....................... 1.1 -> 1.5.6
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Fri Aug 15 10:46:03 IST 2008
[INFO] Final Memory: 10M/167M
[INFO] ------------------------------------------------------------------------

Related

How to use gradle-enterprise-maven-extension behind a proxy?

Willing to use the gradle-enterprise-maven-extension
to migrate a project from maven to gradle,
I cloned the maven-build-scan-quickstart provided by the gradle team.
But runing mvn install, as specified, after acceptation of gradle terms of service,
I receive the following message:
UnknownHostException: scans-in.gradle.com
I tried to configure the proxy in several manners:
Using commannd line option:
mvn install -Dhttps.proxyHost=localhost:8888 -Dhttps.proxyPort=localhost:8888
Using a gradle.properties file in a directory at %GRADLE_USER_HOME% directory location:
(proxy is also configured in maven's settings.xml and need no password it works fine when using maven in standard ways)
gradle.properties :
systemProp.http.proxyHost=localhost
systemProp.http.proxyPort=8888
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost|127.0.0.1
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=8888
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost|127.0.0.1
But I still receive the same message:
~/github/maven-build-scan-quickstart
$ mvn install
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.830 s
[INFO] Finished at: 2019-12-31T13:09:19+01:00
[INFO] ------------------------------------------------------------------------
[INFO] 7 goals, 7 executed
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? (yes/no): yes
[INFO] Gradle Terms of Service accepted.
[INFO]
[INFO] Publishing build scan...
[INFO]
[INFO] A network error occurred.
[INFO]
[INFO] The hostname 'scans-in.gradle.com' could not be resolved.
[INFO] You may be disconnected from the Internet.
[INFO]
[INFO] If you require assistance with this problem, please report it via https://gradle.com/help/plugin and include the following information via copy/paste.
[INFO]
[INFO] ----------
[INFO] Maven version: 3.6.2
[INFO] Extension version: 1.3.3
[INFO] Request URL: https://scans-in.gradle.com/in/maven/3.6.2/1.3.3
[INFO] Request ID: 1234567e-abcd-23de-c2d3-3fbbccd14a32
[INFO] Exception: java.net.UnknownHostException: scans-in.gradle.com
[INFO] ----------
[INFO]

Maven: Full reactor summary after resume a build with mvn goal -rf :module

I'm using maven to manage the build of a large project that it's divided in several modules that are built from the root. So, in this case, maven will use the reactor functionality to build each module in the correct order.Something like this:
root/pom.xml
sp1/pom.xml
sp2/pom.xml
sp3/pom.xml
sp4/pom.xml
I build the project with maven from root directory using the command
mvn clean install
If the build is OK, maven will print the reactor summary:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Root Project ....................................... SUCCESS [ 18.271 s]
[INFO] sp1 ................................................ SUCCESS [ 2.034 s]
[INFO] sp2 ................................................ SUCCESS [ 22.770 s]
[INFO] sp3 ................................................ SUCCESS [03:39 min]
[INFO] sp4 ................................................ SUCCESS [04:39 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46:34 min
[INFO] Finished at: 2017-10-04T17:08:11+00:00
[INFO] Final Memory: 256M/1599M
[INFO] ------------------------------------------------------------------------
But, What happens if one of build phase of one of the subproject fails?. For example, some tests in the sp2 subproject fail and I fix them and relaunch the build from the sp2 with this command
mvn clean install -rf :sp2
The project is built correctly. Then, maven prints the reactor, but not the full reactor, only from sp2. Something like this:
```
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] sp2 ................................................ SUCCESS [ 22.770 s]
[INFO] sp3 ................................................ SUCCESS [03:39 min]
[INFO] sp4 ................................................ SUCCESS [04:39 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46:34 min
[INFO] Finished at: 2017-10-04T17:08:11+00:00
[INFO] Final Memory: 256M/1599M
[INFO] ------------------------------------------------------------------------
My question is: Is it possible to obtain the full reactor summary (including the modules that have been built in the previous execution?)
Reactor Build Order is resolved during Reactor Sorting which leads into a deterministic sequence of execution for the list of projects. The command --resume-from (-rf) as used in:
mvn clean install -rf :sp2
resumes reactor build from the specified project, where the order is similar to as was already been decided, it simply traverses the remaining of the projects in the list which is the updated Reactor Build Order and hence the Reactor Summary corresponds to the new build order.

oozie3.3.2 Build failure while mkdistro.sh command execution

I Getting oozie 3.3.2 from apache.package.org. I can't installed oozie3.3.2 in my system. but I have installed maven in my system.
**Maven version :Apache Maven 2.2.1
Java version: 1.7.0_55**
$/oozie/bin$ ./mkdistro.sh -DskipTests
This line is not executed......
Detailed Error which i am getting
**[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Project 'org.apache.oozie:oozie-hadoop' is duplicated in the reactor
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri May 02 15:49:31 IST 2014
[INFO] Final Memory: 5M/117M
[INFO] ------------------------------------------------------------------------
ERROR, Oozie distro creation failed.**
The system requirements specify the necessary version:
Maven 3.0.1+
The mailing list confirms this:
Maven 3 is required for oozie 3.2.

IntelliJ screws up maven project after crash, can't recover

So I'm working on my project here
https://github.com/dmg46664/migraine
and everything is fine, until my Toshiba fails to resume from sleep and so I have to hard reboot.
Once rebooted, intellij is now suddenly not happy with the project setup. It was perfectly happy before the reboot. This is not the first time stuff like this has happened. Usually, by clicking on maven->reimport/or deleting and reloading modules etc. (usually I'm not sure what fixes it), I eventually get the project into a useable state.
However, I can spend a fair amount of time trying to do this.
Here are screenshots after the screw up.
Everything seems pretty okay from the maven command line. (The html module is expected to fail).
[INFO]
[INFO] --- gwt-maven-plugin:2.5.0:compile (default) # migraine-html ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Migraine Metaproject .............................. SUCCESS [0.701s]
[INFO] Migraine Assets ................................... SUCCESS [0.910s]
[INFO] Migraine Core ..................................... SUCCESS [0.620s]
[INFO] Migraine HTML ..................................... FAILURE [1.390s]
[INFO] Migraine Java ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.966s
[INFO] Finished at: Sun Sep 08 12:01:13 CAT 2013
[INFO] Final Memory: 16M/222M
[INFO] ------------------------------------------------------------------------
So my question is looking for procedures/workarounds to recover from this.
In case editor highlights errors that are not the actual errors in the code and the project still builds, the first thing to try is File | Invalidate Caches | Invalidate and Restart.

Hudson: Builds of multi-module maven project fail, then immediately succeed again

I have a multi-module project where the top level project serves both as the parent of the individual modules and as the project that declares the modules. Only this top level project is configured in Hudson (including automatic SVN checkout). The simplified layout is as follows:
ProjectRoot\
|
+---kernel\
| |
| +---pom.xml [ArtifactId=MyProject_kernel parent=MyProject]
|
+---model_foo\
| |
| +---pom.xml [ArtifactId=MyProject_model_foo, parent=MyProject]
|
+---pom.xml [ArtifactId=MyProject, parent=none]
Also, model_foo has a dependency on kernel.
Now, Hudson automatically discovers the kernel and model_foo sub projects, and it usually manages to build everything just fine.
However, each time I make a breaking change, such as create a new class in kernel and use it inside model_foo, I get a failing build for model_foo, followed by one that succeeds. The mail notifications are titled
Build failed in Hudson: MyProject » MyProject Model Foo #1545
Hudson build is back to normal : MyProject » MyProject Model Foo #1546
Why is that? I suspect it might have to do with the fact that the MyProject pom.xml is both the multi-module project and the parent of its modules, but before changing that I would like to know whether it's actually going to help.
I use Hudson 2.1.0.
Update
This is the log of a failed build of the web module (equals model_foo in the diagram above). The build for the MyProject root project had the same build number, and succeeded.
I stripped out the actual compiler errors, which are exactly the same as if the newly introduced class was missing.
Started by upstream project "MyProject" build number 1545
Found mavenVersion 2.0.9 from file jar:file:/home/builder/opt/apache-maven-2.0.9/lib/maven-2.0.9-uber.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
$ /home/builder/opt/jdk1.5.0_22//bin/java -Xmx1024m -Xms512m -cp /home/builder/var/hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-2.1.0.jar:/home/builder/opt/apache-maven-2.0.9/boot/classworlds-1.1.jar hudson.maven.agent.Main /home/builder/opt/apache-maven-2.0.9 /home/builder/opt/apache-tomcat-6.0.24/webapps/hudson/WEB-INF/lib/hudson-remoting-2.1.0.jar /home/builder/var/hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-2.1.0.jar 48555
<===[HUDSON REMOTING CAPACITY]===> channel started
Executing Maven: -N -B -f <http://ciserver:8080/hudson/job/MyProject/com.mycompany.myproject$web/ws/pom.xml> clean deploy -Dworkspace.path=/home/builder/var/hudson/jobs/MyProject/workspace/ -Droot.project.name=MyRoot -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [clean, deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory <http://ciserver:8080/hudson/job/MyProject/com.mycompany.myproject$web/ws/target>
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 945 source files to <http://ciserver:8080/hudson/job/MyProject/com.mycompany.myproject$web/ws/target/classes>
[HUDSON] Archiving <http://ciserver:8080/hudson/job/MyProject/com.mycompany.myproject$web/ws/pom.xml> to /home/builder/var/hudson/jobs/MyProject/modules/com.mycompany.myproject$web/builds/2011-09-27_13-32-33/archive/com.mycompany.myproject/web/1.1-SNAPSHOT/pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
{{{compiler failure here}}}
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:579)
{{{stacktrace omitted}}}
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
{{{stacktrace omitted}}}
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 7 seconds
[INFO] Finished at: Tue Sep 27 13:33:42 CEST 2011 [INFO] Final Memory: 53M/508M
[INFO] ------------------------------------------------------------------------

Resources