import sublime, sublime_plugin

settings = sublime.load_settings('maven.sublime-build')
mvncmd = settings.get('cmd')
if sublime.platform() == "windows":
    mvncmd = settings.get('windows').get('cmd')

class MavenGoalsCommand(sublime_plugin.WindowCommand):
    wrkDir = None
    cmd = None

    def run(self,working_dir,cmd):
        self.cmd = [cmd]
        self.wrkDir = working_dir
        #print self.wrkDir
        self.window.show_input_panel("mvn",'clean test',self.on_done,None,None)

    def on_done(self, text):
        self.cmd += [u'-B']
        self.cmd += text.split(' ')
        print(self.cmd)
        self.window.run_command("exec",{"cmd":self.cmd, 'working_dir':self.wrkDir})

class MavenCommand(sublime_plugin.WindowCommand):
    def run(self,opts):
        print(opts);
        self.cmd =  [mvncmd] 
        self.cmd += [u'-B']
        self.cmd += opts.split(' ')
        self.window.run_command("exec",{"cmd":self.cmd})
@@ -1,14 +1,18 @@
 import
+ os,
  sublime
@@ -779,19 +779,268 @@
    p
-rint(opts);
+ath, filename = os.path.split(self.window.active_view().file_name())%0A        print(path,filename)%0A        if filename.lower() == %22pom.xml%22 :%0A            self.wrkdir = path%0A        else :%0A            sublime.status_message(%22No pom.xml find.%22)%0A            return
 %0A   
@@ -1122,32 +1122,33 @@
 opts.split(' ')%0A
+%0A
         self.win
@@ -1185,10 +1185,37 @@
 self.cmd
+, 'working_dir':self.wrkdir
 %7D)

check for pom.xml file