SCons 新手在这里。我正在使用它(2.0 版)创建一个 jar,如下所示:
compiled_classes = env.Java \
(target = compiled_classes_dir,
source = source_tld,
JAVAVERSION='1.6',
JAVACLASSPATH=['source_tld/libs/' +
file.name
for file in
Glob('source_tld/' +
'libs/*.jar')])
new_jar = env.Jar(target = jar_name,
source = compiled_classes_dir)
我看到一个问题,其中属于具有内部类的类的类文件(当编译成类文件时名称中有 $
)没有被正确处理,即它们没有被包含在生成的 JAR 中。任何解决此问题的建议将不胜感激。 TIA。
附言:This添加 JAVAVERSION
的建议似乎没有帮助。
最佳答案
由于 SCons 无法正确计算输出类别,因此我建议采用此解决方法。
compiled_classes = env.Java \
(target = compiled_classes_dir,
source = source_tld,
JAVAVERSION='1.6',
JAVACLASSPATH=['source_tld/libs/' +
file.name
for file in
Glob('source_tld/' +
'libs/*.jar')])
#workaround to make sure classes are cleaned
env.Clean(compiled_classes, env.Dir(compiled_classes_dir))
# its important to set the JARCHDIR or the Jar command will not be run
# from the correct location if you want an executable Jar add the manifest here
new_jar = env.Jar(target = jar_name,
source = [compiled_classes_dir], JARCHDIR='$SOURCE')
关于java - SCons 在创建 jar 时没有获取所有类文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17180646/