Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
888 views
in Technique[技术] by (71.8m points)

maven - SonarQube: How to analyze project that used to be submodule of another project?

I have a project with an aggregator POM and several submodules:

com.example:root
  |- com.example:module-a
  |- com.example:module-b
  |- com.example:module-c

It was decided that module-b needs to be a separate project, so the directory module-b was split off into a separate git repository.

Now we have 2 projects:

com.example:root
  |- com.example:module-a
  |- com.example:module-c

com.example:module-b

com.example:root was analyzed for a long time with SonarQube. I use the maven goal sonar:sonar.

Now when I analyze com.example:module-b with SonarQube, I get this error:

2016.02.16 13:03:24 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVLqLZdJf9ZlZw0WwFfK
org.sonar.api.utils.MessageException: Validation of project failed:
  o The project "com.example:project-b" is already defined in SonarQube but as a module of project "com.example:root". If you really want to stop directly analysing project "com.example:root", please first delete it from SonarQube and then relaunch the analysis of project "com.example:project-b".
2016.02.16 13:03:24 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=com.example:project-b | id=AVLqLZdJf9ZlZw0WwFfK | time=302ms

The thing is, yes, in the past com.example:project-b was indeed a module of com.example:root, but it isn't any more now. I also don't want to stop analyzing com.example:root and I don't want to delete it and loose all history and all other modules.

How do I solve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

We have SonarQube 5.1.2. This is how I would try to fix this issue with our version. If this exact procedure doesn't work, maybe it will give you ideas for solving the problem and then we'll refine the answer.

  • Log into SonarQube
  • View the multi-module project
  • In the project menu, click Settings --> Update Key
  • Find module-b in the list of keys, and provide an alternative name - maybe module-b-old
  • Run multi-module analysis to see if that still works
  • Run module-b analysis to see if that works now.

There is also a Reset link; not sure what that does.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...