Skip to content

Refactoring AssemblyMojo#299

Closed
kemitix wants to merge 161 commits intoapache:masterfrom
kemitix:assembly-mojo-refactoring-4.2.x
Closed

Refactoring AssemblyMojo#299
kemitix wants to merge 161 commits intoapache:masterfrom
kemitix:assembly-mojo-refactoring-4.2.x

Conversation

@kemitix
Copy link
Copy Markdown
Contributor

@kemitix kemitix commented May 11, 2017

AssemblyMojo is a 580 line file with a single 257-line method accounting for the bulk of it. It also has no unit tests.

This creates system tests for AssemblyMojo and refactors it into a more manageable structure, all within a new assembly package, with suitable unit tests. Code coverage is 100% from either the system tests or the unit tests.

kemitix added 30 commits May 11, 2017 15:23
maven-project is pinned at 2.0.9, separate from maven.version as the
tooling module updates to maven 3.x which does not have a
maven-project.

Even though maven-project doesn't appear to be used and should
probably be removed, not pinning the version in dependencyManagement
will cause mvn to fail with an unresolved artifact.
Extracts the doExecute() method into it's own class, passing in
AssemblyMojo as a parameter, addorned with suitable set/get methods.
Split into individual tests for each type of dependency.
@cschneider
Copy link
Copy Markdown
Contributor

I will review the changes. Can you fix the conflicts?

@kemitix
Copy link
Copy Markdown
Contributor Author

kemitix commented Jun 1, 2017

On it.

* master: (70 commits)
  [KARAF-5170] Use try-with-resources
  [KARAF-5169] remove redundant type specifiers
  [KARAF-5168] Replace old-style loops
  [KARAF-5154] Upgrade to Felix Framework 5.6.4
  [KARAF-5153] Upgrade to Felix BundleRepository 2.0.10
  [KARAF-5152] Upgrade to commons-compress 1.14
  [KARAF-5151] Upgrade to Aries Transaction Manager 1.3.3
  This closes #305
  KARAF-5162: use new Map methods
  [KARAF-5150] Upgrade to Aries Blueprint Core 1.8.1
  Fix warnings
  [KARAF-5149] Upgrade to JNA 4.4.0
  [KARAF-5123] Fix remove repo issue
  Add toString to RepositoryImpl
  [KARAF-5159] Upgrade to Felix WebConsole 4.3.4
  [KARAF-5148] Remove use of org.json replaced by org.apache.felix.utils.json
  Fix some minor terminal issues
  Fix warnings
  [KARAF-5123] Add test for issue
  [KARAF-5147] Upgrade to pax-web-6.0.4
  ...
@kemitix
Copy link
Copy Markdown
Contributor Author

kemitix commented Jun 1, 2017

Done. :)

@cschneider
Copy link
Copy Markdown
Contributor

Thanks.

I have looked into the code. I think the big benefit it provides is improved testing of AssemblyMojo.

I do not like the refactoring of AssemblyMojo itself too much. It increases the number of classes a lot and even the number of lines in AssemblyMojo.

I did some statistics with cloc:
master (sources without tests):
Java 27 804 1291 5153
AssemblyMojo.java
Java 1 63 129 388

assembly-mojo-refactoring-4.2.x (sources without tests):
Java 39 972 1497 5472
AssemblyMojo.java
Java 1 131 118 430

I think AssemblyMojo needs some refactoring but we should do it less extensively.

You also changed some other stuff like removing the DependencyHelper30 which I think is a good idea.
I guess it was simply needed after the dependency upgrades but it is a good change in itself.

So I would like to check if we can salvage parts of your work while not applying all.
I experimented a bit with picking the AssemblyMojoSystemTest from your code and everything it needs to work. I pushed what I have now to
https://github.com/cschneider/karaf/tree/assembly-mojo-tests/tooling/karaf-maven-plugin

I got most of the tests working 2 errors and 4 failures remain.

So if you are interested to work on this I propose the following:

  1. In one PR provide an update to the poms and removal of the DependencyHelper30 mechanism.
  2. In a second PR provide a fully working implementation of the AssemblyMojoSystemTest (like I started with) while doing only minimal changes in production code.

Then from this base we can discuss how to improve AssemblyMojo.

@kemitix
Copy link
Copy Markdown
Contributor Author

kemitix commented Jun 1, 2017 via email

@grgrzybek
Copy link
Copy Markdown
Contributor

@cschneider @kemitix if #314 is merged, can we close this one? I'm working on new issue I created (Clean up AssemblyMojo - related to Processor mechanism for feature definitions (a.k.a. "better overrides")), so there'll be a bit more refactoring soon

@asfgit
Copy link
Copy Markdown

asfgit commented Nov 8, 2017

FAILURE

--none--

@kemitix
Copy link
Copy Markdown
Contributor Author

kemitix commented Nov 13, 2017

@grgrzybek Guess I never did get back to this. Closing it to clear the way.

@kemitix kemitix closed this Nov 13, 2017
@grgrzybek
Copy link
Copy Markdown
Contributor

Thanks @kemitix for response. I even tried squashing your commits to single one and verify if it's still possible to merge. Your refactoring is impressive, but there were many conflicts, as AssemblyMojo changed since your PR.

I started KARAF-5468 and focused on adding documentation, additional logging and making it consistent with Builder, profiles and features processing. I'm working on it while having your branch opened for inspiration ;)

JiriOndrusek pushed a commit to JiriOndrusek/karaf-1 that referenced this pull request Apr 17, 2019
ENTESB-9638 Update AMQ 7.1.1 clients in Fuse to AMQ 7.2 so that their are aligned with AMQ 7.2 Broker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants