如何使用 Hudson/SVN/Sonar/MSBuild 配置 CI 服务器

发布于 2024-12-25 04:44:29 字数 2055 浏览 5 评论 0原文

我已经安装了带有 hudson/SVN/Sonar 插件/msbuild 插件的 CI 服务器来构建和分析我的 C# 代码(已安装生态系统 C# 插件)。

问题是当我创建作业时出现错误:

[workspace] $ "C:\Program Files\Java\jdk1.7.0_01/bin/java" -cp C:\hudson\jobs\test\workspace\sonar-runner3271937888694838.jar;C:\hudson\jobs\test\workspace\sonar-batch-bootstrapper15605874800135.jar org.sonar.runner.Main -D project.settings=C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties
Project settings: C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties
Runner version: 1.1
Server: http://localhost:9000
Work directory: C:\hudson\jobs\test\workspace\.sonar
17:04:03.874 WARN  Derby database should be used for evaluation purpose only
17:04:03.877 INFO  Create JDBC datasource
17:04:04.408 INFO  Initializing Hibernate
17:04:07.179 INFO  No '.sln' file found or specified: trying to find one...
17:04:07.186 WARN  No '.sln' file specified, and none found at the root of the project: C:\hudson\jobs\test\workspace\.
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public final void org.sonar.api.batch.bootstrap.ProjectBuilder.start()', instance 'org.sonar.plugins.csharp.core.VisualStudioProjectBuilder@44be9164, java.lang.RuntimeException: wrapper
    at org.sonar.runner.Runner.delegateExecution(Runner.java:155)
    at org.sonar.runner.Runner.execute(Runner.java:58)
    at org.sonar.runner.Main.main(Main.java:52)
        ...

我认为它找不到 .sln 文件,但是当我在作业中停用 SVN 或声纳时就可以了。

我在工作中配置: - SVN(svn 服务器的 URL 即可) - Msbuild(C:\hudson\jobs\test\workspace\trunk\test\test.sln 的路径是可以的) - 声纳(C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties 的路径没问题)

我的 sonar-project.properties 文件(.sln 文件和声纳- project.properties 位于同一目录中):

sonar.projectKey=test_app

sonar.projectVersion=0.1

sonar.projectName=test project

sources=.

sonar.language=cs

我的目标是每个开发人员在 svn“运行”hudson 作业上的提交(使用 msbuild 和对代码进行构建和分析)声纳)。

I have installed a CI Server with hudson/SVN/Sonar plugin/msbuild plugin to build and analyse my C# code (ecosystem C# plugin installed).

The problem is when I create a job I get an error :

[workspace] $ "C:\Program Files\Java\jdk1.7.0_01/bin/java" -cp C:\hudson\jobs\test\workspace\sonar-runner3271937888694838.jar;C:\hudson\jobs\test\workspace\sonar-batch-bootstrapper15605874800135.jar org.sonar.runner.Main -D project.settings=C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties
Project settings: C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties
Runner version: 1.1
Server: http://localhost:9000
Work directory: C:\hudson\jobs\test\workspace\.sonar
17:04:03.874 WARN  Derby database should be used for evaluation purpose only
17:04:03.877 INFO  Create JDBC datasource
17:04:04.408 INFO  Initializing Hibernate
17:04:07.179 INFO  No '.sln' file found or specified: trying to find one...
17:04:07.186 WARN  No '.sln' file specified, and none found at the root of the project: C:\hudson\jobs\test\workspace\.
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public final void org.sonar.api.batch.bootstrap.ProjectBuilder.start()', instance 'org.sonar.plugins.csharp.core.VisualStudioProjectBuilder@44be9164, java.lang.RuntimeException: wrapper
    at org.sonar.runner.Runner.delegateExecution(Runner.java:155)
    at org.sonar.runner.Runner.execute(Runner.java:58)
    at org.sonar.runner.Main.main(Main.java:52)
        ...

I think that it doesn't find the .sln file, but when I deactivate the SVN OR Sonar in the job it's OK.

I configured in my job :
- SVN (Url to the svn server is OK)
- Msbuild (path to C:\hudson\jobs\test\workspace\trunk\test\test.sln is OK)
- Sonar (path to C:\hudson\jobs\test\workspace\trunk\test\sonar-project.properties is OK)

My sonar-project.properties file (the .sln file and sonar-project.properties are in the same directory):

sonar.projectKey=test_app

sonar.projectVersion=0.1

sonar.projectName=test project

sources=.

sonar.language=cs

My goal is that each developer's commit on the svn "run" a hudson job (with a build and a analysis of the code with msbuild and sonar).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独留℉清风醉 2025-01-01 04:44:29

我有同样的问题。你的问题解决了吗?

我在构建后创建了一个批处理任务:

cd C:\Program Files\Jenkins\jobs\Contacts\workspace\ProjectName\

sonar-runner -Dsonar.language=cs -Dsonar.projectName=projectName
-Dsonar.projectVersion=1.0-SNAPSHOT -Dsources=”。” -Dsonar.projectKey=projectKey

它正在工作。

I have the same problem. Have you solved your problem ?

I created a batch task after the build :

cd C:\Program Files\Jenkins\jobs\Contacts\workspace\ProjectName\

sonar-runner -Dsonar.language=cs -Dsonar.projectName=projectName
-Dsonar.projectVersion=1.0-SNAPSHOT -Dsources="." -Dsonar.projectKey=projectKey

It's working.

确保添加名为:sonar.dotnet.visualstudio.solution.file="name of the sln file" 的附加声纳属性以及相对于工作区目录的路径,然后就可以开始了。

更多此类属性可以在这里找到:Sonar CSharp Core Plugin

Make sure you add the additional sonar property called: sonar.dotnet.visualstudio.solution.file="name of the sln file" with path relative to the Workspace directory and you will be good to go.

More such properties can be found here: Sonar CSharp Core Plugin

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文