ant 相关问题

Apache Ant(以前称为Jakarta Ant)是一个基于XML的声明式构建工具,最初是为Java项目创建的。它提供了一组丰富的标准任务,用于执行大多数常见的构建操作,例如编译Java源代码,构建存档和运行测试。 Ant的功能可以通过自定义任务和宏进行扩展。

如何使用 Ivy 从私有 Gitlab 项目中的 Maven 存储库下载工件?

作为 Apache Ant 执行的一部分,我需要使用咒语下载一组工件,如下所示,使用解析和检索。 工件位于 Maven 存储库中 那是一部分...

回答 1 投票 0

Ant 找不到类路径类

我正在扩展我公司的 ant 构建脚本,以添加我们想要在某些情况下构建的特殊模块。我编写了一个 ant 脚本,它指向我知道其余部分的已编译类文件的位置

回答 1 投票 0

JDK 18 中 ANT 构建的 System.exit() 有何变化?

<target name="myTask" depends="compile"> <java classname="Main" > <classpath> <pathelement location="${classes.dir}"/> </classpath> </java> <echo message="myTask completed"/> </target> public class Main { public static void main(String[] args) { System.out.println("Main from Java!"); System.exit(0); } } 执行ant myTask: JDK 17 的输出 [java] Main from Java! [echo] myTask completed JDK 18 的输出 [java] Main from Java! JVM 在 JDK 18 中以 System.exit() 退出,但在 JDK 17 中却没有这样做。JDK 18 中是否引入了与此行为相关的已知更改? 由于 SecurityManager 在 JDK 18 中被删除,Ant 似乎从 1.10.14 版本更新了其行为。 使用 Java 18 或更高版本时,如果构建执行 调用“java.lang.System.exit()”的任务以及如果这些任务没有调用 在自己的分叉虚拟机中运行,那么此类任务现在将被终止 整个 Ant 构建过程。 来源:https://downloads.apache.org/ant/RELEASE-NOTES-1.10.14.html

回答 1 投票 0

Kotlin 与 ANT 构建

我已阅读在 Java / ANT 项目中使用 Kotlin 的文档。 我已将构建 .xml 文件与以下内容集成: 我已阅读在 Java / ANT 项目中使用 Kotlin 的文档。 我已将构建 .xml 文件与: 集成 <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"> <classpath> <pathelement location="lib/kotlin-ant.jar"/> </classpath> </typedef> 但我注意到 kotlin-ant 所需的最少库是: kotlin-compiler.jar kotlin-preloader.jar kotlin-reflect.jar kotlin-runtime.jar kotlin-script-runtime.jar kotlin-stdlib.jar 并且它们必须放置在与kotlin-ant相同的目录中。 您确认这是使用 ANT 进行编译的正确方法吗? 您可以尝试在 kotlinc 安装中直接引用原始文件,而不是将 kotlin-ant.jar 复制到项目 lib 目录中。在这种情况下,它还应该找到位于同一目录中的其他所需的 .jar。 它对我有用,我可以仅使用标准 kotlin/java 包来编译和执行简单的独立 kotlin 程序。

回答 1 投票 0

flyway-ant:找不到处理 jdbc 的数据库:

我正在尝试设置一个 ant 构建来调用一些 Flyway-ant 目标,但我总是以构建失败告终 Flyway 错误:找不到处理 jdbc:mariadb://:3...

回答 2 投票 0

Groovy AntBuilder:如何以编程方式从 Ant 任务 exec 获取进程退出代码

我想从通过 Ant 任务执行执行的命令中获取退出代码。请参阅下面的代码示例。 导入 groovy.ant.AntBuilder def cmd = 'ls -l' def ant = new AntBuilder() ant.echo('你好,Ant Build...

回答 1 投票 0

Ant Design 侧边栏菜单项问题

在此图中,您可以看到屏幕底部显示的注销项目。我怎样才能在这里使用 ant design 来做到这一点。 我的侧边栏布局代码: 在此图中,您可以看到屏幕底部显示的注销项目。我怎样才能在这里使用 ant design 来做到这一点。 我的侧边栏布局代码: <Layout> <Sider width="220px" trigger={null} collapsible collapsed={collapsed} style={{ backgroundColor: "#2492EB", height: "100vh", zIndex: 2, overflow: "auto", position: "fixed", }} > <div className="demo-logo-vertical" /> <div style={{ backgroundColor: "white", padding: "14px 0", }} > <img src={logo} alt="" /> </div> <Menu style={{ backgroundColor: "#2492EB", color: "white", marginTop: "10px", }} selectedKeys={[selectedKey ? selectedKey : "/dashboard"]} // defaultSelectedKeys={[sidebarItems[0].key]} items={sidebarItems} onClick={handleMenuSelect} ></Menu> </Sider> <Layout style={{ marginLeft: collapsed ? 80 : 180 }}> <Header style={{ padding: 0, height: "100px", background: colorBgContainer, display: "flex", // Added display: flex alignItems: "center", // Added align-items: center }} > <Button type="text" icon={collapsed ? <MenuOutlined /> : <MenuOutlined />} onClick={() => setCollapsed(!collapsed)} style={{ marginLeft: collapsed ? "20px" : "60px", fontSize: "16px", width: 45, height: 45, marginRight: "10px", }} /> <div className="flex items-center justify-between container mx-auto"> <div className="flex "> <ConfigProvider theme={{ components: { Input: { colorBgContainer: "rgb(244, 244, 244)", }, }, }} > <Input allowClear={true} prefix={<SearchOutlined className="text-[#A7A7A7] " />} placeholder="search here" className="h-[50px] w-[461px] border-0" /> </ConfigProvider> </div> <div className="flex items-center gap-x-6"> <Select options={options} defaultValue={options[0]} value={selectedLanguage} style={{ width: 150 }} onChange={handleSelectLanguage} ></Select> <Link to="/notification " className="flex items-center"> <Badge count={5} className="cursor-pointer"> <IoIosNotificationsOutline style={{ width: "30px", height: "30px" }} /> </Badge> </Link> <div className="flex items-center gap-x-2"> <img src="https://t.ly/18Nvk" className="w-[40px] h-[40px] object-cover rounded-full" alt="" /> <div className="my-[2px]"> <h1 className="font-semibold">Mr. Admin John Doe</h1> </div> </div> </div> </div> </Header> <Content style={{ margin: "0 16px", padding: 24, backgroundColor: "#F6F8FA", borderRadius: borderRadiusLG, }} > <Outlet /> </Content> </Layout> </Layout> 我的侧边栏项目对象数组: export const sidebarItems = [ { key: "/dashboard", label: "Dashboard", icon: <MdOutlineDashboard />, }, { key: "/students", label: "Students", icon: <GoPeople />, }, { key: "/student/dashboard", label: "StudentDashboard", icon: <GoPeople />, }, { key: `/profile/${id}`, label: "Profile", icon: <GoPeople />, }, { key: "/courses", label: "Courses", icon: <BsBook />, }, { key: "/mentors", label: "Mentors", icon: <IoPersonCircleOutline />, }, { key: "/MentorsDashboard", label: "MentorsDashboard", icon: <IoPersonCircleOutline />, }, { key: "/departments", label: "Departments", icon: <LuFolders />, }, { key: "/attendence", label: "Attendence", icon: <PiIdentificationCard />, }, { key: "/events", label: "Events", icon: <BsCalendar2Event />, }, { key: "/class-schedule", label: "Class Schedule", icon: <LuClipboardList />, }, { key: "/wallet", label: "Wallet", icon: <HiOutlineCreditCard />, }, { key: "/setting", label: "setting", icon: <IoSettingsOutline />, }, { key: "/logout", label: "Log Out", icon: <LoginOutlined />, }, ]; 我需要在屏幕底部显示注销菜单。我已经在照片上显示了它。 我的代码是这样工作的: 我需要这样的: 它们可能是多种解决方案来实现所需的电流。我使用 Flex,一个额外的菜单项(将可见性设置为隐藏的分隔项)。如果顶部项目和注销项目之间有足够的空间,则分隔符将占用剩余空间。这是完整的代码。 import { Badge, Button, ConfigProvider, Input, Layout, Menu, MenuProps, Select } from 'antd'; import { BookFilled, CalendarFilled, CreditCardOutlined, DashOutlined, FolderAddFilled, LoginOutlined, NotificationFilled, PaperClipOutlined, SearchOutlined, SettingFilled, UserOutlined, UsergroupAddOutlined, WalletFilled } from '@ant-design/icons'; const { Header, Content, Sider } = Layout; const sidebarItems: MenuProps['items'] = [ { key: '/dashboard', label: 'Dashboard', icon: <DashOutlined /> }, { key: '/students', label: 'Students', icon: <UserOutlined /> }, { key: '/student/dashboard', label: 'StudentDashboard', icon: <UsergroupAddOutlined /> }, { key: `/profile/1`, label: 'Profile', icon: <UserOutlined /> }, { key: '/courses', label: 'Courses', icon: <BookFilled /> }, { key: '/mentors', label: 'Mentors', icon: <UserOutlined /> }, { key: '/MentorsDashboard', label: 'MentorsDashboard', icon: <UsergroupAddOutlined /> }, { key: '/departments', label: 'Departments', icon: <FolderAddFilled /> }, { key: '/attendence', label: 'Attendence', icon: <CreditCardOutlined /> }, { key: '/events', label: 'Events', icon: <CalendarFilled /> }, { key: '/class-schedule', label: 'Class Schedule', icon: <PaperClipOutlined /> }, { key: '/wallet', label: 'Wallet', icon: <WalletFilled /> }, { key: '/setting', label: 'setting', icon: <SettingFilled /> }, { type: 'divider', style: { margin: 0, border: 0, flexGrow: 1, visibility: 'hidden' } }, { key: '/logout', label: 'Log Out', icon: <LoginOutlined /> } ]; const App = () => { return ( <Layout> <Sider width='220px' trigger={null} collapsible style={{ backgroundColor: '#2492EB', height: '100vh', zIndex: 2, overflow: 'auto', position: 'fixed' }} > <div style={{ display: 'flex', flexDirection: 'column', height: 'inherit' }}> <div className='demo-logo-vertical' /> <div style={{ backgroundColor: 'white', padding: '14px 0' }}> <img src='https://t.ly/18Nvk' alt='' style={{ width: '2rem', height: '2rem', borderRadius: '50%', marginLeft: '80px' }} /> </div> <Menu items={sidebarItems} style={{ backgroundColor: '#2492EB', color: 'white', marginTop: '10px', flexGrow: 1, display: 'flex', flexDirection: 'column', paddingBlockEnd: '1rem' }} /> </div> </Sider> <Layout> <Header style={{ padding: 0, height: '100px', display: 'flex', alignItems: 'center' }}> <Button type='text' style={{ fontSize: '16px', width: 45, height: 45, marginRight: '10px' }} /> <div className='flex items-center justify-between container mx-auto'> <div className='flex '> <ConfigProvider theme={{ components: { Input: { colorBgContainer: 'rgb(244, 244, 244)' } } }}> <Input allowClear={true} prefix={<SearchOutlined className='text-[#A7A7A7] ' />} placeholder='search here' className='h-[50px] w-[461px] border-0' /> </ConfigProvider> </div> <div className='flex items-center gap-x-6'> <Select /> <a className='flex items-center'> <Badge count={5} className='cursor-pointer'> <NotificationFilled style={{ width: '30px', height: '30px' }} /> </Badge> </a> <div className='flex items-center gap-x-2'> <img src='https://t.ly/18Nvk' className='w-[40px] h-[40px] object-cover rounded-full' alt='' /> <div className='my-[2px]'> <h1 className='font-semibold'>Mr. Admin John Doe</h1> </div> </div> </div> </div> </Header> <Content style={{ margin: '0 16px', padding: 24, backgroundColor: '#F6F8FA' }}></Content> </Layout> </Layout> ); }; export default App;

回答 1 投票 0

无法使用ANT脚本预编译jsps-Weblogic服务器

我现在正在为 Web 应用程序编写 ANT 脚本(而且我对 ant 脚本和 weblogic 服务器管理知之甚少)。 当我执行 ant 脚本时,一切正常,除了...

回答 1 投票 0

Maven 和 Ant 无法运行 Java - CreateProcess error=206,文件名或扩展名太长

当maven通过antrun执行这个java代码时,我得到可怕的错误=206,文件名或扩展名太长 当 maven 通过 antrun 执行此 java 代码时,我收到可怕的错误=206,文件名或扩展名太长 <java classname="com.me.api" failonerror="true" fork="true" maxmemory="128m" output="${wsdlFile}.out"> <arg value="${className}" /> <arg value="${name}" /> <arg value="${wsdlFile}" /> <classpath> <path refid="maven.test.classpath" /> </classpath> 由于本地 Maven 存储库的结构和位置,Maven 创建了冗长的类路径。我们需要使用路径 jar。 将类路径转换为字符串 转义 Windows 驱动器号(C: = 坏 \C: = 好) 创建具有类路径属性的仅清单 jar 使用路径jar而不是maven编译类路径 <mkdir dir="${classpath-compile.dir}"/> <!-- Convert into usable string . --> <pathconvert property="compile_classpath_raw" pathsep=" "> <path refid="maven.compile.classpath"/> </pathconvert> <!-- escape windows drive letters (remove C: from paths -- need to wrap with a condition os.family="windows")--> <propertyregex property="compile_classpath_prep" input="${compile_classpath_raw}" regexp="([A-Z]:)" replace="\\\\\1" casesensitive="false" global="true"/> <!-- Create pathing Jars --> <jar destfile="${classpath-compile.jar}"> <manifest> <attribute name="Class-Path" value="${compile_classpath_prep}"/> </manifest> </jar> <java classname="com.me.api" failonerror="true" fork="true" maxmemory="128m" output="${wsdlFile}.out"> <arg value="${className}" /> <arg value="${name}" /> <arg value="${wsdlFile}" /> <classpath> <pathelement location="${classpath-compile.jar}" /> </classpath> 扩展@user4386022提供的答案:您可以定义(从Ant 1.8开始)这个宏,如果您在构建过程中的不同位置遇到相同的问题,它可以帮助您(并且您不能只是在各处复制粘贴相同的代码片段,因为Ant 不允许重新定义属性,因此您将收到错误消息,指出“manifest.classpath”已定义。) <macrodef name="create-classpath-jar" description="Create classpath Jar, to avoid getting the error about CreateProcess error=206, The filename or extension is too long"> <attribute name="classpathjar"/> <attribute name="classpathref"/> <sequential> <!-- Turn the classpath into a property formatted for inclusion in a MANIFEST.MF file --> <local name="manifest.classpath.property"/> <manifestclasspath property="manifest.classpath.property" jarfile="@{classpathjar}"> <classpath refid="@{classpathref}" /> </manifestclasspath> <!-- Create the Jar --> <jar destfile="@{classpathjar}"> <manifest> <attribute name="Class-Path" value="${manifest.classpath.property}"/> </manifest> </jar> </sequential> </macrodef> 要在目标或任务中使用宏,只需像这样使用它: <path id="myclasspath"> ......... </path> <create-classpath-jar classpathjar="classpath-compile.jar" classpathref="myclasspath" /> 如果使用 Ant 1.7 或更高版本,您可以利用 manifestclasspath 任务生成清单文件,然后将其包含在 jar 中以在 javac 类路径上使用 <!-- turn the classpath into a property formatted for inclusion in a MANIFEST.MF file --> <manifestclasspath property="manifest.classpath" jarfile="${classpath-compile.jar}"> <classpath refid="maven.compile.classpath" /> </manifestclasspath> <!-- Create pathing Jars --> <jar destfile="${classpath-compile.jar}"> <manifest> <attribute name="Class-Path" value="${manifest.classpath}"/> </manifest> </jar> <java classname="com.me.api" failonerror="true" fork="true" maxmemory="128m" output="${wsdlFile}.out"> <arg value="${className}" /> <arg value="${name}" /> <arg value="${wsdlFile}" /> <classpath> <pathelement location="${classpath-compile.jar}" /> </classpath> 通过从 build.xml 文件中的 javac 目标中删除 fork="true" 解决了问题。如果您的构建过程强制要求分叉,请参阅上面的解决方案。 Java 提供了一种简单的机制来永久解决这个问题,它被称为 @argfile。这个想法很简单: 您无需将所有参数作为命令行参数附加到 java 命令,而是将它们写入一个简单的文本文件,其中每个参数位于单独的行中,例如使用 echo 任务。 然后指定所述文本文件的位置,如下所示:java @myArguments.txt Java 然后读取文本文件并展开它在其中找到的任何内容作为参数。由于您使用 Ant,您的配置可能如下所示: <property name="test_classpath" refid="maven.test.classpath"/> <echo message="-classpath&#xD;&#xA;${test_classpath}&#xD;&#xA;${className}&#xD;&#xA;${name}&#xD;&#xA;${wsdlFile}" file="${project.build.directory}/antJvmArgs.txt"/> <java classname="com.me.api" failonerror="true" fork="true" maxmemory="128m" output="${wsdlFile}.out"> <arg value="@${project.build.directory}/antJvmArgs.txt" /> </java> 一些补充说明: &#xD;&#xA; 是 CRLF(Windows 换行符)的 XML 编码版本。 作为参考,生成的文本文件将如下所示: -classpath C:\Users\username\git\myProject\target\test-classes;C:\Users\username\git\myProject\target\classes what.ever.the.value.of.className.Is ValueOfTheNameVariable C:\Users\username\git\myProject\target\wsdlFile.wsdl

回答 5 投票 0

使 ANT Java 目标像 Java 命令一样工作

这些是我尝试在 Ant 中模拟的命令: cd“../强化学习任务生成器” java -cp“bin;../Utilities/bin;../强化学习/bin”edu.uky.ai...

回答 1 投票 0

如何在 PHP 中实现两个节点之间的最短路径的蚁群算法?

我的目标是使用蚁群算法获得图中两个节点之间的最短路径及其长度。 假设我们有一个这样的图表: $图=数组( 数组(0,5,7,3,0), 数组(5,0...

回答 1 投票 0

从命令行清理并构建 Netbeans java 项目

我在 Netbeans 下有一个 java 应用程序项目(ant),我想以编程方式调用类似于 Netbeans 的 clean 和 build(清理项目然后构建它)命令的操作...

回答 2 投票 0

在旧的基于蚂蚁的网络应用程序中找不到类异常

我正在尝试让基于 ANT 的旧应用程序在 Tomcat 上运行。当我在 Eclipse 中运行它时,出现以下错误: 引起原因:java.lang.NoClassDefFoundError: org/eclipse/birt/core/exce...

回答 1 投票 0

什么是tools.jar替换?

当我尝试构建 Ant 项目时,我在 Eclipse 上收到以下错误 com.sun.tools.javac.Main 不在类路径上。 也许JAVA_HOME没有指向JDK。 目前是...

回答 2 投票 0

如何在 Ant 复制过程中剥离一个文件夹

我有一个文件,其文件路径类似于“LibraryX/A/Stuff/FileY.txt”,我在 Ant 构建中将其用作包含文件。但是,我需要在复制期间删除路径的“LibraryX/A/”部分

ant
回答 2 投票 0

Mac 上的 Ant 出现“目录创建因未知原因未成功”错误

我有一个可以在 Windows 上构建和运行的项目,但是当我将其转移到 MacOS (Sierra) 并在 IntelliJ 中设置 Resin、Ant 和项目的其余部分时,构建失败了,并出现相当严重的

回答 2 投票 0

Azure DevOps“未找到蚂蚁”

我有预置 Ant 的自托管 Windows 代理,它放置在 C:\Program Files nt\ 下,但是,当我尝试使用 Ant 任务时: - 任务:Ant@1 输入: buildFile: 'buildFiles...

回答 1 投票 0

如何从 Eclipse 运行`ant clean`

就像我可以通过右键单击 build.xml 并选择 Run as --> Ant build 来运行 ant 构建一样,如何对 ant clean 执行同样的操作?

回答 2 投票 0

Ant Javac 和 Commandline Javac 给出不同的结果

我有一个导入一些 servlet 库的类。当我从命令行编译它时,一切都很好。 当我使用ant编译任务来编译它时,它给出了找不到servlet的错误

回答 3 投票 0

Ant 命令在 Windows 上未被识别为内部或外部命令

我只是想从 Windows 终端运行 ant。我将 /bin 目录放在 C:\Program Files pache-ant pache-ant-1.10.14 下。我将其添加为 ANT_HOME 系统变量,并添加了 %ANT_HOME% i...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.