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)
我看到一个问题,其中属于具有内部类的类(当编译成类文件时名称中有$
的类)的类文件未得到正确处理,即它们不会包含在生成的内容中罐。任何建议,以解决这个问题将不胜感激。 TIA。
PS:This建议添加JAVAVERSION
似乎没有帮助。
答案 0 :(得分:0)
由于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')