fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

Cleanup root pom.xml #4194

Closed davsclaus closed 9 years ago

davsclaus commented 9 years ago

We should cleanup the root pom.xml, and maybe introduce a "bom" or parent/pom.xml etc with minimal noise and just the dependency versions so we have a nice bom for fabric8 users to import.

We could like in apache camel have a parent folder with a pom.xml that is of bom type. There we can have all the version in properties section. And also add all the managed dependencies.

davsclaus commented 9 years ago

@oscerd btw do you know if there is any maven plugin or some tricks to figure out of unused versions.

eg we have a bunch of versions in the properties section of the root pom.xml that are from the fabric8 v1 days. Today many of those are no longer in use and should be removed.

Then what is remained should maybe be checked for new versions. There is a maven plugin that can do that afair.

oscerd commented 9 years ago

The first plugin I thought it's maven-dependency-plugin with analyze-only goal.

The output it's something like this:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.fabric8:bom:pom:2.2-SNAPSHOT
[WARNING] 'parent.relativePath' points at io.fabric8:fabric8-project instead of org.sonatype.oss:oss-parent, please verify your project structure @ line 22, column 13
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.fabric8:fabric8-agent:jar:2.2-SNAPSHOT
[WARNING] The expression ${version} is deprecated. Please use ${project.version} instead.
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.fabric8:gateway-core:jar:2.2-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: io.fabric8:gateway-apiman:jar -> duplicate declaration of version (?) @ io.fabric8:gateway-core:[unknown-version], /home/ancosen/workspace/git_repo/fabric8/components/gateway-core/pom.xml, line 207, column 21
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.fabric8:kubernetes-api:bundle:2.2-SNAPSHOT
[WARNING] The expression ${build} is deprecated. Please use ${project.build} instead.
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Fabric8 :: Bill of material
[INFO] Fabric8
[INFO] Fabric8 :: Parent
[INFO] Fabric8 :: APT
[INFO] Fabric8 :: Components
[INFO] Fabric8 :: Utils
[INFO] Fabric8 :: CXF Utils
[INFO] Fabric8 :: Kubernetes Code Generator
[INFO] Fabric8 :: Kubernetes API
[INFO] Fabric8 :: Git Repo :: API
[INFO] Fabric8 :: Taiga :: API
[INFO] Fabric8 :: Maven Plugin
[INFO] Fabric8 :: Annotations
[INFO] Fabric8 :: Kubernetes Assertions
[INFO] Fabric8 :: Kubernetes Jolokia
[INFO] Fabric8 :: Jolokia Assertions
[INFO] Fabric8 :: Arquillian Extension
[INFO] Fabric8 :: Console
[INFO] Fabric8 :: Docker :: API
[INFO] Fabric8 :: Build Workflow
[INFO] Fabric8 :: CDI
[INFO] Fabric8 :: jBPM WorkItems
[INFO] Fabric8 :: Spring Boot
[INFO] Fabric8 :: APM Agent
[INFO] Fabric8 :: Agent
[INFO] Fabric8 :: CXF Component
[INFO] Fabric8 :: Swagger Maven Plugins
[INFO] Fabric8 :: Groups
[INFO] Fabric8 :: JGroups
[INFO] Fabric8 :: Vert.x
[INFO] Fabric8 :: Gateway :: API
[INFO] Fabric8 :: Gateway :: ApiMan
[INFO] Fabric8 :: Gateway :: Model
[INFO] Fabric8 :: Gateway :: Core
[INFO] Fabric8 :: Gateway :: Fabric Support
[INFO] Fabric8 :: Gateway :: Servlet
[INFO] Fabric8 :: Gateway :: Servlet :: Example
[INFO] Fabric8 :: Git Repo :: RestEasy
[INFO] Fabric8 :: Hubot :: API
[INFO] Fabric8 :: Karaf Features
[INFO] Fabric8 :: Kubernetes Generator
[INFO] Fabric8 :: MQ :: Parent
[INFO] Fabric8 :: MQ :: Client
[INFO] Fabric8 :: MQ :: Camel AMQ Component
[INFO] Fabric8 :: Rest Utils
[INFO] Fabric8 :: Swagger Model
[INFO] Fabric8 :: Tooling
[INFO] Fabric8 :: Tooling :: Archetype Builder
[INFO] Fabric8 :: Forge Parent
[INFO] Fabric8 :: Forge Addons
[INFO] Fabric8 :: Forge Addons :: Utils
[INFO] Fabric8 :: Forge Addons :: Camel
[INFO] Fabric8 :: Forge Addons :: Kubernetes
[INFO] Fabric8 :: Forge Addons :: OpenShift
[INFO] Fabric8 :: Forge :: REST Service
[INFO] Fabric8 :: Forge :: REST Service
[INFO] Fabric8 :: Wiki
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: Bill of material 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ bom ---
[INFO] Skipping pom project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ fabric8-project ---
[INFO] Skipping pom project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: Parent 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ fabric8-parent ---
[INFO] Skipping pom project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: APT 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ fabric8-apt ---
[WARNING] Unused declared dependencies found:
[WARNING]    org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: Components 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ components ---
[INFO] Skipping pom project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: Utils 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ fabric8-utils ---
[WARNING] Unused declared dependencies found:
[WARNING]    com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile
[WARNING]    io.fabric8:fabric8-apt:jar:2.2-SNAPSHOT:provided
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: CXF Utils 2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:analyze-only (default-cli) @ cxf-utils ---
[WARNING] Used undeclared dependencies found:
[WARNING]    com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile
[WARNING]    org.apache.cxf:cxf-core:jar:3.0.4:compile
[WARNING]    com.fasterxml.jackson.core:jackson-databind:jar:2.4.1:compile
[WARNING]    org.apache.cxf:cxf-rt-transports-http:jar:3.0.4:compile
[WARNING]    com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.4.1:compile
[WARNING]    javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[WARNING] Unused declared dependencies found:
[WARNING]    junit:junit:jar:4.11:test
[WARNING]    io.fabric8:fabric8-apt:jar:2.2-SNAPSHOT:provided
[INFO] 
.
.
.

There is also the Depedency convergence report that is part of Maven Project Info Report Plugin ( http://maven.apache.org/plugins/maven-project-info-reports-plugin/ ), useful to make some clean up.

The fast solution can be the first, I'll investigate other solutions :-)

Maybe it's not what we are looking for.

oscerd commented 9 years ago

It's an interesting problem, I'll do some research.

Using dependency:analyze doesn't resolve the problem, we need to make some analysis on the output of the maven plugin execution...

oscerd commented 9 years ago

I didn't use a specific maven plugin. My friend grep is always reliable :-)

davsclaus commented 9 years ago

Ah btw I think @iocanel work on some kind of BOM generation. So we may have that covered. Maybe @iocanel could tell us a bit about his work

iocanel commented 9 years ago

@davsclaus: yeah, I hacked a small plugin that iterates in all projects found in the maven reactor and adds them to a bom. The generated bom can then be installed, deployed and what not.

The good thing about it is that the generated bom does not require maintenance. You add/remove modules from your project and the bom will be generated. Also, its a real bom that doesn't contain noise.

The bad thing is that in some case its nice to be able and provide an extra bom (which contains tooling stuff, or a couple of really really really strict dependencies). If we cover this too, We can then maybe completely remove the current bom and move forward with the generated one.