integrating non-java projects with jenkins, maven, and artifactory.

995 views
Skip to first unread message

Khai Do

unread,
Jun 11, 2011, 2:55:02 PM6/11/11
to Jenkins Users
Hello, I'm looking for some help on how to best integrate a C++
project using the google test framework with Jenkins and
Artifactory.

My Environment:
1. jenkins 1.4.0.9
2. maven-2.2.1
3. artifactory pro setup with jenkins integration

I would like my maven C++ project to do the following:
1. execute build
2. execute tests
3. publish test reports
4. deploy to artifactory.

I have the google test running and outputing results to a junit xml
test report. I'm using maven to execute the build and it's running
from a maven pom.xml. I have surefire plugin set to skip because I
have no java code or tests in this project.

It seems like i have two options when setting up a jenkins job:
A. maven 2/3 project OR
B. freestyle project.

Setting up a job with option A will allow me to do 1, 2, and 4, but
NOT 3.
Option B will allow me to do 1, 2, and 3, but NOT 4.

The reason why 3 doesn't work in option A is because test reports are
only triggered on an execution of the surefire plugin. Again I set
the surefire plugin to skip so the test reports are not getting
published to the jenkins CI. There's no option to "Publish JUnit test
result report" in a maven 2/3 job configuration.

The reason why 4 doesn't work in option B is because freestyle
projects do not have the option to publish to artifactory (or it's
been deprecated and doesn't seem to work).

So my question is how can i get my jenkins CI job to do 1, 2, 3 and
4? Any suggestions would be appreciated. Thanks.

Eyal Edri

unread,
Jun 12, 2011, 3:40:03 AM6/12/11
to jenkins...@googlegroups.com
I know maven has a native plugin to compile c++ -
http://maven.apache.org/maven-1.x/plugins/native/
Maybe you can use it to compile your code in maven.

You can run it as a maven job in Jenkins.

Geoff Bullen

unread,
Jun 14, 2011, 3:49:01 AM6/14/11
to jenkins...@googlegroups.com
Hi,

Can you not just run the deploy goal to push to artifatory?  I.e. option B (freestyle).  As long as your distribution management configuration is set up OK, you should be OK, I'd have thought.   

Alternatively you could always use maven deploy:deploy-file as one of your build steps?   

Cheers,

Geoff Bullen 
Centrum Systems 
Level 8, 5 Elizabeth Street 
Sydney 

  
0408 659 395 (m) 
02 9235 0516 (t)
 
http://www.centrumsystems.com.au

Michael Pisula

unread,
Jun 14, 2011, 3:52:30 AM6/14/11
to Jenkins Users
Hi,

which Maven plugin do you use to compile your C++ sources? The nar
plugin?
I am thinking of doing something very similar to your approach, so I
am very interested in a solution to your problem.

I guess the XUnit plugin will not work with the maven plugin as well.
Your best option is probably to raise an issue with either one of the
plugins that prevent you from using your approach. From what you tell
the problem with the artifactory plugin seems to be a bug, so you
might want to take a look if there is already an issue for that. Then
you could use a free style job.

Best regards,
Michael

Khai Do

unread,
Jun 14, 2011, 9:35:21 AM6/14/11
to jenkins...@googlegroups.com
Thanks for the suggestion.  I am using the maven deploy as a workaround.  it's not great because I lose the integration with Artifactory.  The icons links to the artifactory deployment do not appear on jenkins when using a maven deploy.  Also I prefer to not to use the deploy for multi-module project because it may partially deploy on failures.  I guess the the best solution would be to use the Artifactory plugin on a jenkins freestyle project, however it's not available for freestyle. 

Brian Smith

unread,
Jun 14, 2011, 3:36:56 PM6/14/11
to jenkins...@googlegroups.com
Hi there

Have you tried using this jenkins plugin?


Provided your report output is html it should allow you to do step 3 with option A.

Cheers

Brian

Khai Do

unread,
Jun 14, 2011, 6:34:01 PM6/14/11
to jenkins...@googlegroups.com
Thanks Brian.  I guess you mean use maven to run the C++ test-> generate html report from xml-> then use jenkins to report html.  Good idea.  However this isn't ideal either because when jenkins doesn't process the test xml report it won't accumulate and publish statistics on test results.

I have come to the conclusion that the "Publish JUnit test result report" plugin should appear in Jenkin's Maven 2/3 jobs configuration page.  This would allow me to publish C++ test results and publish builds to Artifactory.  I don't see an issue for this use case in the jenkins issue tracker, so i think i will add one.

Yossi Shaul

unread,
Jun 20, 2011, 9:43:55 AM6/20/11
to jenkins...@googlegroups.com
Hi,

Artifactory plugin supports Maven 3 freestyle projects. We encourage the usage of the native jobs but the free style is still supported and we plan to keep supporting it (it was marked as deprecated in one of the plugins version but this is no longer the case).

If you have any issues with it please open an issue at https://issues.jfrog.org/jira/browse/HAP.

Regards,

Yossi Shaul
JFrog

Khai Do

unread,
Jun 20, 2011, 7:15:59 PM6/20/11
to jenkins...@googlegroups.com
The artifactory plugin in the jenkins freestyle jobs says "Maven3-Artifactory Integration (deprecated)".  Will it also work for maven-2.2.1?  I'm using maven-2.2.1 and am having a difficult time getting it to deploy.  The console logs shows a successfully build and it installs the generated build artifacts to the local .m2/repository, however the report from jenkins says the build failed. 

Yossi Shaul

unread,
Jul 5, 2011, 5:44:36 AM7/5/11
to jenkins...@googlegroups.com
No, the freestyle works only with Maven 3.
Sorry for the late reply.

Yossi
Reply all
Reply to author
Forward
0 new messages