我正在尝试在OS X上编译TuxGuitar(吉他谱编辑器)。我已经从TuxGuitar存储库中签出了代码:svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
现在,当我运行反过来使用make
的ant
时,似乎javac
在项目源代码树中找不到Java包。我将make
的完整输出放在http://people.kth.se/~albertwi/tuxg-make-error处;它很大,所以我不能将所有内容都放在代码块中。
我假设这是一个半普通的类路径问题,但我不知道如何修改构建配置。在第307行以及make
输出中,存在以下错误/警告,形式为“ some_file.java添加为some_file.class不存在”,我不知道这意味着什么:
[javac] org/herac/tuxguitar/app/TGMain.java added as org/herac/tuxguitar/app/TGMain.class doesn't exist.
[javac] org/herac/tuxguitar/app/TuxGuitar.java added as org/herac/tuxguitar/app/TuxGuitar.class doesn't exist.
[javac] org/herac/tuxguitar/app/action/TGActionAccessInterceptor.java added as org/herac/tuxguitar/app/action/TGActionAccessInterceptor.class doesn't exist.
...
在715行及以后的代码中,包含了一些类路径,但似乎并没有在其中添加所有必需的文件夹(TuxGuitar源代码树以TuxGuitar形式包含了一些文件夹,例如一些程序组件/ src / org / herac / tuxguitar,例如TuxGuitar -ascii / src / org和TuxGuitar-fluidsynth / src / org,我认为应该将其包括在此处,但它们不是):
[javac] Compilation arguments:
[javac] '-d'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build'
[javac] '-classpath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build:/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar:/opt/local/share/java/apache-ant/lib/ant-launcher.jar:/opt/local/share/java/apache-ant/lib/ant-antlr.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bcel.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bsf.jar:/opt/local/share/java/apache-ant/lib/ant-apache-log4j.jar:/opt/local/share/java/apache-ant/lib/ant-apache-oro.jar:/opt/local/share/java/apache-ant/lib/ant-apache-regexp.jar:/opt/local/share/java/apache-ant/lib/ant-apache-resolver.jar:/opt/local/share/java/apache-ant/lib/ant-apache-xalan2.jar:/opt/local/share/java/apache-ant/lib/ant-commons-logging.jar:/opt/local/share/java/apache-ant/lib/ant-commons-net.jar:/opt/local/share/java/apache-ant/lib/ant-jai.jar:/opt/local/share/java/apache-ant/lib/ant-javamail.jar:/opt/local/share/java/apache-ant/lib/ant-jdepend.jar:/opt/local/share/java/apache-ant/lib/ant-jmf.jar:/opt/local/share/java/apache-ant/lib/ant-jsch.jar:/opt/local/share/java/apache-ant/lib/ant-junit.jar:/opt/local/share/java/apache-ant/lib/ant-junit4.jar:/opt/local/share/java/apache-ant/lib/ant-netrexx.jar:/opt/local/share/java/apache-ant/lib/ant-swing.jar:/opt/local/share/java/apache-ant/lib/ant-testutil.jar:/opt/local/share/java/apache-ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar'
[javac] '-sourcepath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src'
...
然后在1143行及以后的行中,出现“包org.herac.tuxguitar.some包不存在”错误:
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:27: error: package org.herac.tuxguitar.action does not exist
[javac] import org.herac.tuxguitar.action.TGActionManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:68: error: package org.herac.tuxguitar.document does not exist
[javac] import org.herac.tuxguitar.document.TGDocumentManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:69: error: package org.herac.tuxguitar.event does not exist
[javac] import org.herac.tuxguitar.event.TGEvent;
[javac] ^
...
我不太熟悉
make
和ant
。如何以及在哪里进行配置更改,以便javac
可以找到软件包?问题是否牵扯进来,以至于我应该问TuxGuitar开发人员呢?
更新:我尝试按照https://sourceforge.net/p/tuxguitar/discussion/522984/thread/3843b30b/#1ce9的建议使用另一种编译方式,因此我转到文件夹build-scripts / tuxguitar-macosx-cocoa-64并运行
mvn clean package -Dnative-modules=true
,但是随后出现与SWT相关的错误... ,基本上(在http://people.kth.se/~albertwi/tuxg-mvn-error处的完整输出):[INFO] Scanning for projects...
[ERROR] The build could not read 18 projects -> [Help 1]
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. @ org.herac.tuxguitar:tuxguitar:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml, line 26, column 15
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar-browser-ftp:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. @ org.herac.tuxguitar:tuxguitar-browser-ftp:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml, line 35, column 15
[ERROR]
...
我在/ Library / Java / Extensions中拥有swt.jar的最新版本(4.4),因此它应该位于类路径上。
最佳答案
我遇到了同样的麻烦,因为使用ant而不是maven时,makefile看起来好像坏了。
这是我执行的步骤(由于我的初出茅庐的Clément是我在使用打孔卡时随Java诞生的):
$svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
$sudo apt-get install maven
$cd tuxguitar-code
$uname -a
Linux acacia 3.16-3-amd64 #1 SMP Debian 3.16.5-1 (2014-10-10) x86_64 GNU/Linux
$cd build-scripts/tuxguitar-linux-x86_64
$rehash
$mvn clean package
$cd target
$cd tuxguitar-1.3-SNAPSHOT-linux-x86_64
$./tuxguitar.sh
这确实对我在3台不同的计算机上都起作用,尽管它们都是基于debian的。
希望这可以帮助