Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove outdated Maven artifacts from Jenkins Maven2/3 job?

Over the last couple of months I have restructured (renamed) my Maven modules of my project. I discovered some unexpected behavior with respect to how Jenkins treats outdated Maven modules (i.e., they no longer exist in pom.xml files) produced by the build job.

This is depicted in the following screenshot:

Picture of outdated modules

As can be seen several modules are skipped (= grey bubble). Sadly, however from the UI, I have no chance to delete them by any means. Deleting the workspace does not help either. Actually, the problem exists in other build jobs as well in case a renaming of one ore more modules was conducted in the pom structures.

The next screenshot shows a German version of the menu options.

Menu entries in the project job view

Despite I used the latest Jenkins version (2.23), there seems to be no possibility to clean up the ui / modules from this project.

Does anybody have an idea how I can achieve removing this obsolete artifacts without a fresh setup of the whole project or even the complete build server installation.

EDIT-1:

There is an offical issue for that at the Jenkins Project, which seems to be unresolved up to day.

EDIT-2:

I've tried the work arround mentioned in the issue using http://hudson-installation/job/the-project/deleteAllDisabledModules in order to obtain the delete view. However, this page does not exist.

like image 476
rzo1 Avatar asked Sep 30 '16 12:09

rzo1


People also ask

What does Mvn clean do?

mvn clean: Cleans the project and removes all files generated by the previous build. mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code.

Which command is used to run the clean life cycle followed by verify install?

This command consists of the mvn command which executes Maven, and the build life cycle named clean . This maven command executes the clean build life cycle and the install build phase in the default build life cycle.


2 Answers

Goto:

http://jenkins-ci/job/<projectname>/<package>$<modulename>/

and click delete.

look at:

http://jenkins-ci/job/<projectname>/modules
like image 120
oletjens Avatar answered Sep 24 '22 12:09

oletjens


I think this answer from Amedee Van Gasse provides at least a workaround to your problem.

He suggests removing the modules marked as "(übersprungen)" by hand using a Groovy script. His solution also implies why the use of http://hudson-installation/job/the-project/doDeleteAllDisabledModules won't work: The property disabled isn't properly set for the respective modules.

like image 31
user6368437 Avatar answered Sep 24 '22 12:09

user6368437