boxuk / jslint-jenkins-plugin

Runs JSLint on a project and outputs in the Checkstyle format.
13 stars 15 forks source link

FileNotFoundException #4

Closed ghost closed 11 years ago

ghost commented 11 years ago

I'm trying to use the JSLint plugin however I'm having the following error:

[JSLint] Ready [JSLint] calling jslint with args[-DxmlOutput=C:\Documents and Settings\gcampos.jenkins\jobs\ens\workspace/jslint_result.xml, C:\Documents and Settings\gcampos.jenkins\jobs\ens\workspace\src\Weg.Applications.ENS.Web\js\combobox\ens.comboBase.js] [JSLint] IO Error java.io.FileNotFoundException: C:\Documents%20and%20Settings\gcampos.jenkins\plugins\jslint\WEB-INF\classes\com\boxuk\jenkins\jslint\JSLintBuilder\jslint.js (system can not find the specified path) [JSLint] Complete Finished: SUCCESS

gavD commented 11 years ago

Hi,

It may be that this plugin needs some work to support Windows fully - our CI setup is primarily Linux based.

A few questions to diagnose this:

  1. What version of the plugin are you using?
  2. Does C:\Documents%20and%20Settings\gcampos.jenkins\plugins\jslint\WEB-INF\classes\com\boxuk\jenkins\jslint\JSLintBuilder\jslint.js exist on your box?

Thanks,

ghost commented 11 years ago

I'm using the latest version and the path exist. I believe the problem is with blanks that are replaced by %20 and Windows can not understand.

Thanks!

gavD commented 11 years ago

Yes, that seems reasonable. Are you in a position where you could write a patch and test it? If not, it might have to wait until I can get a Windows box set up to test on

ghost commented 11 years ago

I'm not be able to write a patch, but I'll wait. Thank you so much!

scott-davidjones commented 11 years ago

got a windows box here if you can point me in the right direction..

scott-davidjones commented 11 years ago

hmm ok i have changed line105 in \src\main\java\com\boxuk\jenkins\jslint\LintRunner.java from:

String file = res.toString().replaceAll("file:", "")

to:

String file = res.toString().replaceAll("file:", "").replaceAll("%20", " ");

however i have no idea how to compile and test.

gavD commented 11 years ago

Hi Arazmus,

Best thing to do would be to fork this repo and then submit a unit test that exposes the issue. If that's not feasible, you build the plugin using Maven:

mvn

That will build the plugin for you and you can then install it on your own Jenkins server through the "Advanced" tab of the Plugin Manager.

Incidentally, this plugin is now available for install via the Jenkins Plugin manager via their repositories, so you don't need to build it yourself unless you want to make changes to it.

Thanks,

scott-davidjones commented 11 years ago

Hi Gavin,

Already forked but and made the change locally but cant test it. not used maven before and have the plugin installed from Jenkins already. is it just a case of going to the Dir and running mvn ?

Just trying to fix this windows bug (although am moving over to ubuntu as we speak on VirtualBox)

gavD commented 11 years ago

You will need to install Apache Maven

http://maven.apache.org/

You should only need the "mvn" command and that should pull in all dependenices, run tests, and build

is it just a case of going to the Dir and running mvn ?

correct :-)

scott-davidjones commented 11 years ago

thanks was already downloading maven :)

now just to add the JAVA_HOME and anything else ive missed...

gavD commented 11 years ago

How did you get on? I can compile it from my end if you're stuck? On 17 Jan 2013 17:38, "Arazmus" notifications@github.com wrote:

thanks was already downloading maven :)

now just to add the JAVA_HOME and anything else ive missed...

— Reply to this email directly or view it on GitHubhttps://github.com/boxuk/jslint-jenkins-plugin/issues/4#issuecomment-12379325.

scott-davidjones commented 11 years ago

if you could that would be great! having trouble with setting the JAVA_HOME Var..

is it the JDK you need? (new to java stuff)

gavD commented 11 years ago

You will need the JDK. I'll probably catch flak for this, but go with the Oracle JDK. OpenJDK pretty much always lets me down in some way!

Give this one a go - https://dl.dropbox.com/u/15591232/jslint-scott.hpi

Thanks,

scott-davidjones commented 11 years ago

hehe just got it to work! have my JAVA_HOME pointing to /bin rather than the main dir.

I have also had problems with openJDK on ubuntu in the past..

ok that fixed it, but got a violations module error, but atleast the windows jslint bug is fixed :)

full console output:

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check
Checkout:Code Check / C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check - hudson.remoting.LocalChannel@4d0371
Using strategy: Default
Last Built Revision: Revision 695a33796d167cbd916b2208a2f1ac346a224153 (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from C:\Users\Scott.Jones\Google Drive\workspace\testApp
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 695a33796d167cbd916b2208a2f1ac346a224153 (origin/HEAD, origin/master)
Checking out Revision 695a33796d167cbd916b2208a2f1ac346a224153 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
[JSLint] Ready
[JSLint] calling jslint with args[-DxmlOutput=C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check/build/jslint.xml, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\all.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\allocation.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\availability.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\booking.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\booking_search.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\brochurerequest.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\cabins.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\client.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\common.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\createbooking.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\db_handler.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\enquiry.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\login.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\misc\accordion.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\not needed\ChartHelper.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\not needed\Layout.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\not needed\Menu.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\not needed\Nav.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\not needed\app.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\page_controller.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\payment.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\colorpicker.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\date-en-GB.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\date.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\eye.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.alert.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.blockUI.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.cookie.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.googlemaps.pack.1.01.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.idle-timer.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.indexeddb-old.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.indexeddb.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.modal.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.session.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.tipsy.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.ui.timepicker.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.uniform.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.validationEngine-en.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.validationEngine.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.visualize.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\jquery.visualize.tooltip.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\plugins\widget-tabs.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\send_message.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\tab_controller.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\viewbooking.js, C:\Program Files (x86)\Jenkins\workspace\Test Project\Code Check\src\assets\js\viewclient.js]
[JSLint] Complete
ERROR: Publisher hudson.plugins.violations.ViolationsPublisher aborted due to exception
java.io.IOException: Expecting tag jslint
    at hudson.plugins.violations.parse.AbstractParser.expectNextTag(AbstractParser.java:268)
    at hudson.plugins.violations.types.jslint.JsLintParser.execute(JsLintParser.java:25)
    at hudson.plugins.violations.parse.AbstractTypeParser.parse(AbstractTypeParser.java:57)
    at hudson.plugins.violations.ViolationsCollector.doType(ViolationsCollector.java:187)
    at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:114)
    at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:25)
    at hudson.FilePath.act(FilePath.java:852)
    at hudson.FilePath.act(FilePath.java:825)
    at hudson.plugins.violations.ViolationsPublisher.perform(ViolationsPublisher.java:74)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732)
    at hudson.model.Run.execute(Run.java:1568)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
Finished: FAILURE

can send you the jslint if required but it looks fine..

tadaok commented 11 years ago

It´s not a good idea to use this code:

String file = res.toString().replaceAll("file:", "").replaceAll("%20", " ");

because there is a hundreds of Url encodes as we can se in http://www.w3schools.com/tags/ref_urlencode.asp

a better solution is use the URLDecoder class:

file = java.net.URLDecoder.decode(file);
gavD commented 11 years ago

OK, thanks - any chance you could submit a PR? If not, might be a while before I get round to making that change, pretty busy at the mo'

jarmenia commented 11 years ago

Was this fix ever completed? We are running into this exact problem with our jenkins install. JSLint plugin version 0.7.6.

Thanks,

John

scott-davidjones commented 11 years ago

the siles i got sent did fix it but i agree that @Tadaok's solution is a more robust one. Could this get added?

gavD commented 11 years ago

as I have said, please feel free to submit a pull request with this patch in it. I'm extremely busy on project work at the moment. Otherwise, it'll have to wait for at least two weeks.

mamaximov commented 11 years ago

Hi, could you update the plugin?

gavD commented 11 years ago

This has been done. Unfortunately, nobody submitted a PR so I had to do it myself.

I've run the Maven deploy gubbins, hopefully the update will have taken but I'm a bit rusty on Maven so I'll keep an eye on it. Version >=0.7.8 is what you need.

scott-davidjones commented 11 years ago

Sorry, my bad. Ment to do that.. On 17 Apr 2013 10:20, "Gavin Davies" notifications@github.com wrote:

This has been done. Unfortunately, nobody submitted a PR so I had to do it myself.

I've run the Maven deploy gubbins, hopefully the update will have taken but I'm a bit rusty on Maven so I'll keep an eye on it. Version >=0.7.8 is what you need.

— Reply to this email directly or view it on GitHubhttps://github.com/boxuk/jslint-jenkins-plugin/issues/4#issuecomment-16495387 .

gavD commented 11 years ago

not to worry! It's done now, version 0.7.7 is available on the update centre :-)

mamaximov commented 11 years ago

Thank you guys! Just a small issue elapsed (on Windows server 2008R2, if you want I'll provide more detailed info):

[JSLint] Ready [JSLint] calling jslint with args[-DxmlOutput=c:\projectnamegoeshere\ci\trunk\Source/jslint.xml] [JSLint] IO Error java.io.FileNotFoundException: file:\C:\Program Files (x86)\Jenkins\plugins\jslint\WEB-INF\classes\com\boxuk\jenkins\jslint\JSLintBuilder\jslint.js (The filename, directory name, or volume label syntax is incorrect) [JSLint] Complete

..and all .NET developers will say thanks to you!

gavD commented 11 years ago

Hi @mamaximov , please could you open a new ticket for that problem, and I will see what I can do

Thanks,

mis026 commented 11 years ago

I have same problem of mamaximov after upgrade version to 0.7.7.

gavD commented 11 years ago

Oh globbits :-( I don't have a Windows test environment to test this, best I can do is to roll it back, unless one of the guys in the office can help.

mis026 commented 11 years ago

Thank you for your reply. I'm realllllllllly want to back to the version 0.7.6. Can you send me jslint plugin(ver. 0.7.6) .hpi file? If you can do that, plz send me an email with attached .hpi file.

gavD commented 11 years ago

I've just made a Windows VM and I'm seeing if I can fix it now.

gavD commented 11 years ago

Urrgh :-( I think I have fixed this issue but it won't release.

[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy (default-deploy) on project jslint: Failed to deploy artifacts: Could not transfer artifact org.jenkins-ci.plugins:jslint:hpi:0.7.8 from/to maven.jenkins-ci.org (http://maven.jenkins-ci.org:8081/content/repositories/releases): Failed to transfer file: http://maven.jenkins-ci.org:8081/content/repositories/releases/org/jenkins-ci/plugins/jslint/0.7.8/jslint-0.7.8.hpi. Return code is: 401 -> [Help 1]

Literally no idea what that's about...

gavD commented 11 years ago

OK, I got the deploy to work and version 0.8.0 is released. It'll be on the Jenkins update centre in 6 hours or so but if you can't wait that long take a look at http://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/jslint/0.8.0/

mis026 commented 11 years ago

Thank you for your kindness! I'm really appreciate you. lol

jamiegood commented 11 years ago

Odd. I'm getting this error after updating to jenkins 1.519

[JSLint] IO Error java.io.FileNotFoundException: jar:/var/lib/jenkins/plugins/jslint/WEB-INF/lib/classes.jar!/com/boxuk/jenkins/jslint/JSLintBuilder/jslint.js (No such file or directory) [JSLint] Complete

thanks Jamie

gavD commented 11 years ago

This issue was resolved is closed, but issue #8 is open to cover subsequent problems with the release of the new Jenkins.