gpt4 book ai didi

ant - Apache Ant 和掘金

转载 作者:行者123 更新时间:2023-12-02 11:02:46 24 4
gpt4 key购买 nike

我一直在尝试在我的PC上使用Nuggeta Server。但是问题是,当我运行build.xml时,它会抛出sym,bol找不到和其他错误,有人可以帮助我吗?

这是ant显示的编译错误:

[echo] Compiling the java source files...
[javac] Compiling 3 source files to C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\classes
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:5: error: package org.slf4j does not exist
[javac] import org.slf4j.Logger;
[javac] ^
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:6: error: package org.slf4j does not exist
[javac] import org.slf4j.LoggerFactory;
[javac] ^
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:8: error: package com.nuggeta.game.core.ngdl.nobjects does not exist
[javac] import com.nuggeta.game.core.ngdl.nobjects.NGame;
[javac] ^
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:9: error: package com.nuggeta.game.core.ngdl.nobjects does not exist
[javac] import com.nuggeta.game.core.ngdl.nobjects.NGameMessage;

和更多
 C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:39: error: cannot find symbol
[javac] public IncommingRequestStatus onMessage(NPlayer player, Message message) {
[javac] ^
[javac] symbol: class Message
[javac] location: class GameMessageServerInterceptor
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:39: error: cannot find symbol
[javac] public IncommingRequestStatus onMessage(NPlayer player, Message message) {
[javac] ^
[javac] symbol: class IncommingRequestStatus
[javac] location: class GameMessageServerInterceptor
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:55: error: cannot find symbol
[javac] public IncommingRequestStatus onAdminMessage(Message message) {
[javac] ^
[javac] symbol: class Message
[javac] location: class GameMessageServerInterceptor
[javac] C:\Users\Development\Desktop\nuggetaWorkspace\NuggetaServer\src\com\nuggeta\gameserver\GameMessageServerInterceptor.java:55: error: cannot find symbol
[javac] public IncommingRequestStatus onAdminMessage(Message message) {
[javac] ^
[javac] symbol: class IncommingRequestStatus
[javac] location: class GameMessageServerInterceptor

这是构建文件
<project name="NuggetaGameServer" basedir="." default="jar">
<target name="jar" description="jar">
<delete file="lib/myServer.jar" />

<mkdir dir="classes" />
<echo message="Compiling the java source files..." />
<javac destdir="classes" debug="on" failonerror="yes" includeantruntime="false">
<src path="src" />
</javac>

<jar destfile="lib/myServer.jar">
<zipfileset dir="classes/" />
</jar>
</target>

我已经导入了libs游戏服务器和myServer

最佳答案

您缺少对第3方jars的依赖。一个明显的例子是对SLF4J logging framework的依赖:

  • Search for org.slf4j.Logger

  • 在所有编程语言中(不仅仅是Java),管理编译和运行时依赖项都是一个不小的问题。我无权访问您的代码,但您的构建文件似乎不足。

    假设您的第3方jars位于“lib”目录中,那么我期望的是:
    <project name="NuggetaGameServer" basedir="." default="jar">

    <path id="compile.path">
    <fileset dir="lib"/>
    </path>

    <target name="jar" description="jar">
    <delete file="lib/myServer.jar" />

    <mkdir dir="classes" />
    <echo message="Compiling the java source files..." />
    <javac destdir="classes" debug="on" failonerror="yes" includeantruntime="false" classpathref="compile.path">
    <src path="src" />
    </javac>

    <jar destfile="lib/myServer.jar">
    <zipfileset dir="classes/" />
    </jar>
    </target>

    注意javac任务上的“classpathref”属性。这会将“lib”目录中的jar添加到编译时类路径中。

    关于ant - Apache Ant 和掘金,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32112128/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com