Ok, first up I am almost completely unfamiliar with Java and Java tooling.
I am attempting to contribute a bugfix to a Jenkins plugin. Code-wise the fix is simple, my problem is in trying to compile the project and run the tests locally.
I have installed IntelliJ IDEA 15CE and started a new project, pointing it to my local clone of the plugin repo.
It has gone away and 'downloaded the internet' in terms of Maven dependencies. Mostly everything looks ok. What I want to do is to run the tests...
If I right-click at the root of the project and select 'Run All Tests' I get the error:
Error:(115, 29) java: cannot find symbol
symbol: variable Messages
location: class hudson.plugins.copyartifact.BuildSelector
The source of this error is a line:
console.println(Messages.CopyArtifact_MissingSrcArtifacts(srcDir));
https://github.com/jenkinsci/copyartifact-plugin/blob/master/src/main/java/hudson/plugins/copyartifact/BuildSelector.java#L115
As far as I can tell the Messages symbol should resolve to this properties file:
https://github.com/jenkinsci/copyartifact-plugin/blob/master/src/main/resources/hudson/plugins/copyartifact/Messages.properties
...which IDEA recognises as a 'Resource Bundle' in the project tree view.
But it doesn't seem to recognise it when compiling the project.
I have no idea where to start fixing this. The tests run fine if I push a commit to a pull request on GitHub and let the cloudbees.com Jenkins server run them, but I'd like to be able to test stuff locally first.
Run the maven compile command from Intelli-J Maven tool. After compiling error will vanish.
When you compile it will generate a Messages.java file in generated sources automatically.
Related
When I try to import project from github to Intellij Idea, it succesfully getting.
I want to run it and see the output. But when I compile it, I get the error cannot start compilation.
Here is the picture of my error.
As I understand from the error, the output directory is not exist.
I use Project Structure --> Project compiler output to initialize it.
I described it as projectname\out. Also my compiler output is set to Inherit project compile output path.
Then I rebuild my project but it doesn't success.
I just want to run github project in Intellij Idea.
[RemoteTestNG] detected TestNG version 6.13.0
Cannot find class in classpath
Tried almost everything mentioned in the previous blogs. Cleaned the project, updated Maven project, restarted Eclipse etc, Edited the TestNG XML file with the package name.class name as mentioned. But still the issue persists.
org.testng.TestNGException:
Try to run the test from Maven command line interface.
1. Go to the project path.
2. Enter the command "mvn clean install".
I have had this several times and this was the solution.
Note: Maven needs to be installed on PC and its environment variables have to be set.
Background:
So my team is using Microsoft's git services and we've set up some CI tests. We are not using Maven, and the project is connected to the remote server through the Eclipse Microsoft Team services plugin, but I try to interact with the remote repo mostly through the command line.
Current Strategy:
I'm not too familiar with how to deal with dependencies on a remote repo for Java projects but I've tried simply pushing the .jar dependencies in our build path with the rest of the source code (I know they're big and there's probably a better way to do this).
Problem:
When I push the .jar files, the CI tests still fail with the following errors:
src\JBLASTests.java(1):src\JBLASTests.java(1,): error : [javac] d:\a\1\s\
src\JBLASTests.java:1: error: package org.junit does not exist
src\JBLASTests.java(5):src\JBLASTests.java(5,): error : [javac] d:\a\1\s\
src\JBLASTests.java:5: error: package org.jblas does not exist
And then more error reports related to the missing symbols due to the packages not being found.
Questions:
1) What else needs to be on the repo to make the build work?
2) Is there a better way, besides Maven, to link the libraries to the repo?
(I'm not averse to using Maven I just want to find a simpler solution for the interim).
Apologies if this is a duplicate. I searched but couldn't find any other posts regarding this situation.
It looks like the dev who set up the CI tests set them up with an Ant build task despite that not being how we currently handle dependencies. Thank you howgler for pointing out that the CI might be building differently than I do locally. I'll post this answer in case anyone else runs into this issue and doesn't think to check the CI build settings (and also update the title appropriately).
Lesson
Make sure that the CI build task is the same as how you're building locally. Until you add dependencies and try to push them, your builds might be succeeding, so it can be misleading that your CI settings are incorrect.
I was developing an application like ordinary Java Web application, but because I want to deploy it to Heroku, I needed it to become Maven project, so I created an empty Maven project with Eclipse and copied all of libraries I was using and all of my source code.
When I do mvn compile on my local machine, it goes well, but app isn't really working.
When I do git push heroku master I get error like
package com.mysite.java.classes does not exist
Locally I have maven-compiler-plugin ver 3.1 and source and target set to 1.7, although I'm using 1.8 jdk. I changed it to 1.7 since I saw here Pushing my repository to heroku fails that it has issues with Heroku.
Here is a project structure
I'm not really experienced with Maven, so I hope somebody can help. I guess imports aren't working as intended because I get whole list of errors like this
symbol: class Connection
location: class com.vukstankovic.professionalorientation.Personalities
[ERROR] /tmp/build_0bc5a80c-dc14-4126-b15b-69390f18dc9f/src/main/java/com/vukstankovic/professionalorientation/Personalities.java:[48,19] cannot find symbol
Class Connection in this example is mysql class from com.mysql.jdbc.Connection
I'm having hard time to setup springframework code in Intellij.
I git-cloned springframework project from github, and ran ant task to get all the libraries into ivy-cache directory.
I found "spring-framework.ipr" file for intellij project, and opened it.
Unfortunately, some of the libraries are not correctly mapped to the jar files or missing. So I cannot compile the codebase in IDE.
I also tried importing as eclipse project into intellij. Jar file reference seems ok.
But there are compilation errors in OXM module. Some test classes have reference to auto generated classes such as "~.samples.flight.FlightDocument", "~.jaxb.test.FlightType", and they don't exist(ant test goal generates them in target dir).
It seems same problem happens in STS.
I referenced this blog post:
http://blog.springsource.org/2009/03/03/building-spring-3/
Any good idea to setup spring code in intellij?
I use intellij v11.
git branch: 3.1.x
git commit: e8fc90ce3e4554f14eaa86ce05591249d3fe62fa
Compilation error example:
.../org.springframework.oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller Tests.java
Error:(29,42) package org.springframework.samples.flight does not exist
Error:(30,42) package org.springframework.samples.flight does not exist
Error:(44,9) cannot find symbol class FlightsDocument
Error:(44,58) package FlightsDocument does not exist
....
Thanks,
problem solved.
"spring-framework.ipr" is the one for intellij.
lesson learned:
simply wrong version of junit was referenced in spring-framework.ipr file.
when ant build failed middle of the test, subsequent module won't be built. so, required libraries won't be downloaded into ivy-cache/repository.
"ant jar" goal will not download test related libraries since the goal doesn't run tests
After all the tests passed and manually fixed junit reference, intellij finally has no errors.