Sublimelinter doesn't have easy to follow documentation. So here's what I did to get it working for me.
In your sublimetext project file, you have to set up the SublimeLinter object and configure the Java lint settings.
Suppose you have a project structure like so:
C:\path\to\projectname
├───src
│ ├───main
│ │ ├───java
│ │ │ └───com
│ │ │ └───yoursite
│ │ ├───resources
│ │ └───webapp
│ │ └───WEB-INF
│ └───test
│ └───java
│ └───com
│ └───yoursite
└───target
├───classes
│ └───com
│ └───yoursite
├───projectname
│ ├───META-INF
│ └───WEB-INF
│ ├───classes
│ │ └───com
│ │ └───yoursite
│ └───lib
├───javadoc-bundle-options
├───maven-archiver
└───surefire
working_directory
: The absolute path to your work area. (Anyone know how to reference paths in the folders.path
?) Also, the rest of the paths are relative to this one.
lint_args
: arguments passed to javac
-sourcepath
: path to your source files.
classpath
: path to compiled classes.
-Xlint
, -Xlint:-serial
: javac
command line options.
{filename}
: SublimeLinter reference to the current file.
From javac
-Xlint: Enable all recommended warnings. In this release, all available warnings are recommended.
-Xlint:serial: Warn about missing serialVersionUID definitions on serializable classes.
projectname.sublime-project 1
{
"folders": [
{
"path": "C:\\path\\to\\projectname",
"name": "projectname"
}
],
"settings": {
"SublimeLinter":
{
"Java":
{
"working_directory": "C:\\path\\to\\projectname",
"lint_args":
[
"-sourcepath", "src/main/java;c:\\some\\absolute\\path",
"-classpath", "C:\\Users\\UERNAME\\.m2\\repository\\path\\to\\file.jar;target/classes",
"-Xlint", "-Xlint:-serial",
"{filename}"
]
}
}
}
}