简体   繁体   中英

How to add java file to project for build

I am working on a large project java project (not created by myself) that requires being built with Ant (and a build file). I have a .java file that I wrote, that I'd like to add to this project. Do I need to update the build file and/or do I need to be careful with where in the project directory I put my .java file? Thanks.

As long as you are putting it into the source folder the ant is point towards then it will work just fine. However, you have to put it into the package structure as the file dictates.

The second one. The building in ant xml file you will see this

    <project name="HelloWorld" basedir="." default="main">
      <property name="work.home"    value="${basedir}/work"/>
      <property name="dist.home"     value="${basedir}/dist"/>
   <property name="src.home"      value="${basedir}/src"/>--> Here you new java
      <property name="web.home"      value="${basedir}/web"/>

So if you don't have your Java file in your src.home it will not compile. to The Target

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM