Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[#1086] Recursively add jars to the classpath inside app lib folder t…

…o allow for subdirectories
  • Loading branch information...
commit c68fe835c6a4faa532d15f139edafdd4579e2d6e 1 parent fb2931d
Brian Nesbitt authored

Showing 1 changed file with 16 additions and 4 deletions. Show diff stats Hide diff stats

  1. +16 4 framework/pym/play/application.py
20 framework/pym/play/application.py
@@ -112,6 +112,20 @@ def name(self):
112 112
113 113 # ~~~~~~~~~~~~~~~~~~~~~~ JAVA
114 114
  115 + def find_and_add_all_jars(self, classpath, dir):
  116 +
  117 + # ignore dirs that start with ".", example: .svn
  118 + if dir.find(".") == 0:
  119 + return
  120 +
  121 + for file in os.listdir(dir):
  122 + fullPath = os.path.normpath(os.path.join(dir,file))
  123 + if os.path.isdir(fullPath):
  124 + self.find_and_add_all_jars(classpath, fullPath)
  125 + else:
  126 + if fullPath.endswith('.jar'):
  127 + classpath.append(fullPath)
  128 +
115 129 def getClasspath(self):
116 130 classpath = []
117 131
@@ -119,11 +133,9 @@ def getClasspath(self):
119 133 classpath.append(os.path.normpath(os.path.join(self.path, 'conf')))
120 134 classpath.append(os.path.normpath(os.path.join(self.play_env["basedir"], 'framework/play-%s.jar' % self.play_env['version'])))
121 135
122   - # The application
  136 + # The application - recursively add jars to the classpath inside the lib folder to allow for subdirectories
123 137 if os.path.exists(os.path.join(self.path, 'lib')):
124   - for jar in os.listdir(os.path.join(self.path, 'lib')):
125   - if jar.endswith('.jar'):
126   - classpath.append(os.path.normpath(os.path.join(self.path, 'lib/%s' % jar)))
  138 + self.find_and_add_all_jars(classpath, os.path.join(self.path, 'lib'))
127 139
128 140 # The modules
129 141 for module in self.modules():

0 comments on commit c68fe83

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