用waf构建Java项目

时间:2015-05-28 13:02:29

标签: java python jar wsh waf

我使用了this演示代码来创建构建我的java项目的wscript。现在我想在一个不同的输出目录中创建一个jar文件,而不是创建我的类文件。

当我尝试添加此行时:

jaropts = '-C default/src/ .', # can be used to give files

python说:

AttributeError: 'str' object has no attribute 'append'

甚至可以使用waf为单个文件指定多个输出路径,并且jaropts是配置它的正确位置吗?

Traceback (most recent call last):
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Scripting.py", line 108, in waf_entry_point
    run_commands()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Scripting.py", line 169, in run_commands
    ctx=run_command(cmd_name)
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Scripting.py", line 160, in run_command
    ctx.execute()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Scripting.py", line 371, in execute
    return execute_method(self)
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Build.py", line 104, in execute
    self.execute_build()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Build.py", line 111, in execute_build
    self.compile()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Build.py", line 174, in compile
    self.producer.start()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Runner.py", line 170, in start
    self.refill_task_list()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Runner.py", line 98, in refill_task_list
    self.outstanding.extend(self.biter.next())
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Build.py", line 405, in get_build_iterator
    self.post_group()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Build.py", line 389, in post_group
    f()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/TaskGen.py", line 110, in post
    v()
  File "/home/user/java_test/.waf-1.8.10-f3a5181891ad6643633329fcfb4381b3/waflib/Tools/javaw.py", line 122, in jar_files
    jaropts.append('-C')
AttributeError: 'str' object has no attribute 'append'

1 个答案:

答案 0 :(得分:0)

the source开始,jaropts应该是一个参数列表,而不是一个字符串。

尝试jaropts = ['-C', 'default/src/', '.']