Skip to content
Browse files

Merge pull request #333 from briannesbitt/lighthouse-1086-patch

[#1086] Recursively add jars to the classpath inside app lib folder
  • Loading branch information...
2 parents 353cd13 + c68fe83 commit 1594db3049e9ad5aac7882e804f3c1c3b52373ce @pepite pepite committed Aug 31, 2011
Showing with 16 additions and 4 deletions.
  1. +16 −4 framework/pym/play/application.py
View
20 framework/pym/play/application.py
@@ -112,18 +112,30 @@ def name(self):
# ~~~~~~~~~~~~~~~~~~~~~~ JAVA
+ def find_and_add_all_jars(self, classpath, dir):
+
+ # ignore dirs that start with ".", example: .svn
+ if dir.find(".") == 0:
+ return
+
+ for file in os.listdir(dir):
+ fullPath = os.path.normpath(os.path.join(dir,file))
+ if os.path.isdir(fullPath):
+ self.find_and_add_all_jars(classpath, fullPath)
+ else:
+ if fullPath.endswith('.jar'):
+ classpath.append(fullPath)
+
def getClasspath(self):
classpath = []
# The default
classpath.append(os.path.normpath(os.path.join(self.path, 'conf')))
classpath.append(os.path.normpath(os.path.join(self.play_env["basedir"], 'framework/play-%s.jar' % self.play_env['version'])))
- # The application
+ # The application - recursively add jars to the classpath inside the lib folder to allow for subdirectories
if os.path.exists(os.path.join(self.path, 'lib')):
- for jar in os.listdir(os.path.join(self.path, 'lib')):
- if jar.endswith('.jar'):
- classpath.append(os.path.normpath(os.path.join(self.path, 'lib/%s' % jar)))
+ self.find_and_add_all_jars(classpath, os.path.join(self.path, 'lib'))
# The modules
for module in self.modules():

0 comments on commit 1594db3

Please sign in to comment.
Something went wrong with that request. Please try again.