I created the javadocs in my Eclipse Project with the Export >> Java >> Java-doc. The directory structure is MyProject >> docs >> javadoc.
I have two questions:
How can I generate the javadoc automactilly with the Eclipse Build?
How can I generate the javadoc automactilly with pattner MyProject-javadoc.jar with Eclipse Build?
The second question is the more important, because I know how generate manually the javadoc, but I don't know how to create the *-javadoc.jar.
When you configure Javadoc generation using wizard invoked from Project->Generate Javadoc... you have an option to generate ant script for your settings. You can then invoke (or copy to) the generated ant target from your main build script.
To generate the archive itself you can simply package the folder with generated documentation as a jar file. Add something similar to the following target to your ant scripts:
<target depends="javadoc" description="build javadoc jar" name="package-docs">
<jar compress="true" destfile="javadoc.jar" basedir="doc" />
</target>
Related
I'm using netbeans 8.1. How can I add a Javadocs to a Project_Name.jar file without using the Edit Jar Reference?
I tried to use the build.xml file in my java project but I can only create a javadocs.jar and javadocs folder .
This is the code I tried thanks to user805575 code
<target name="-post-jar" description="bundle sources and javadoc in a jar" depends="javadoc">
<jar compress="${jar.compress}" basedir="${src.dir}" jarfile="${dist.dir}/${application.title}-sources.jar"/>
<jar compress="${jar.compress}" basedir="${test.src.dir}" jarfile="${dist.dir}/${application.title}-test.jar"/>
<jar compress="${jar.compress}" basedir="${dist.javadoc.dir}" jarfile="${dist.dir}/${application.title}-javadoc.jar"/>
This code allow me to create a javadoc.jar and source.jar, but what I want is to already add the javadocs and sources to the Project_Name.jar to avoid manually adding it when I clean and build
In the folder of nbproject there is a file name project.properties, i see a code excludes=file.reference.Project_Name-javadoc.jar = dist\\Project_Name-javadoc.jar which i manually add the javadocs using the Edit Jar Reference how can I code this in .xml file or .properties? So I can use my jar in any java project with Javadocs
To create a new maven project in Netbeans go File->New Project
You should see a this
This will create a new Maven project
You can then use Maven to build your project. This will create your sources jar as well, which I assume you are refering to when you say javadocs.
If you plan to become a Java developer tools such as Maven are vital. It will be well worth your time reading up here
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
I am using Eclipse 4.5.2 to deploy JavaFX application (JDK 1.8). I want to change an IniFile during the installation. Ant task or JavaFX deploy is generating a wxi and wxs file in temp folder AppData\Local\Temp\fxbundler5060494280971686435\windows
But I want that Ant is using my custom wxs file. How Do I do that?
I did not find a clear description where to place my custom wxs file. I placed it under my project \build\Package\Windows\test.wxs.
But output is stating:
Config files are saved to C:\Users\xxx\AppData\Local\Temp\fxbundler5060494280971686435\windows. Use them to customize package.
Using default package resource [WiX config file] (add package/windows/test.wxs to the class path to customize)
My folder structure looks like this:
project
src
ressources
build
build
classes
libs
src
package
windows
test.wxs
build.xml
What do I have to do, that my custom wxs file is used???
Thanks in advance.
I got the same problem . while,I used inno setup to build setup.exe file .
My solution is writing my own inno setup script based on javafx script which found in C:\Users\xxx\AppData\Local\Temp\fxbundler5dss886329843971686435\windows, then writing an another ant task depends on fx:deploy task that I execute the innosetup script in command line like blow:
<target name="do-mydeplopy" depends="do-fxdeploy, prepare-deploy">
<exec executable="iscc">
<arg value="my-deploy.iss"/>
</exec>
</target>
You should learn how to write the setup script.
I'm following this tutorial about creating JNI files for Mac OS X. The tutorial is written for NetBeans, but I'm trying to follow it with Eclipse. Unfortunately, this has caused me to be stuck at step 4.1.3, which is about generating a .h file using ant:
Modify the build.xml file of your Netbeans project by adding the
following before the closing tag:
<target name="-post-compile">
<javah
destdir="./build"
force="yes"
class="ca.weblite.jniexample.NSSavePanel"
classpath="./build/classes"
/> </target>
First off, it seems that Eclipse projects don't include a build.xml file by default, so I used these instructions to generate one. Then I added the command as shown above. But when I build with the ant script, the .h file does not get built. No error message related to this is generated.
I believe that the reason is because Eclipse projects do not have a "./build" folder as shown in the examples, but I don't know what to put in its place. Could anybody please let me know how to fix this issue?
First, let's assume your Eclipse project folder structure is like this:
src/ (source files)
bin/ (compiled class files)
The above folders should be configured in your Java Build Path (see Project > Properties). The below folder and file you will need to create yourself (just right-click > New...).
build/ (build products)
build.xml (build script)
Inside each of bin and src folders, you should have a sub-directory structure like:
ca
|--weblite
|--jniexample
There should be a source file at src/ca/weblite/jniexample/NSSavePanel.java. And there should be a compiled class file at bin/ca/weblite/jniexample/NSSavePanel.class.
Your build.xml file should look like this:
<project name="Build" default="-post-compile">
<target name="-post-compile">
<javah destdir="./build" force="yes" class="ca.weblite.jniexample.NSSavePanel" classpath="./bin" />
</target>
</project>
After executing your build script, you should see a file at build/ca_weblite_jniexampe_NSSavePanel.h.
I'm using NetBeans to import a series of libraries from my Arduino IDE. I'm following directions from the following link:
http://silveiraneto.net/2009/03/01/arduino-and-java/
This works provided I use the Arduino-0013 version of the IDE install, more current versions do not compile using this method.
I have found that using the Arudino-0013 set as the working directory is NOT necessary if I manually move the "preferences.txt" and "keywords.txt" and "librxtxSerial.so" files into the lib folder in my Java dist (build) folder, and also move the entire Arduino-0013 "Hardware" folder also into my Java dist (build) folder.
When I do this I can run the Java program from the dist directory on the command line. Using the command:
java -jar myProgram.jar
rather than having to go into the Arudino-0013 as my working directory and use -cp to get my program to work (which I haven't worked out how to do incidentally):
Is there a way to include these .txt files and the Arudino hardware folder with all the files it contains when I build the project with NetBeans? The reason I ask is because it's getting annoying having to do this manually every time I do a new build.
My answer is not specific to netbeans but you can try:
Make an Apache ANT build file to build your project. In that file make a copy task which will copy txt files in your build. By doing this you will not have to so it manually. See here: http://wiki.netbeans.org/NetbeansedAnt to know how to work with ANT in NetBeans.
In Netbeans, if you switch from the Projects tab to the Files tab, you'll see that you have a build.xml file. This is an Ant build.xml file. You can configure Ant to automatically copy the files for you whenever your build your project. You would essentially have something like this:
<project ...>
<target name="-pre-compile">
<copy file="some/path/preferences.txt" todir="../some/dir"/>
<copy file="some/path/keywords.txt" todir="../some/dir"/>
<copy file="some/path/librxtxSerial.so" todir="../some/dir"/>
</target>
<target name="-post-compile">
<copy todir="build/dir">
<fileset dir="some/path/Arduino-0013"/>
</copy>
</target>
</project>
There is more information in the build.xml file about what you can and can't hook into. The Ant documentation is good, and the Tasks section of the Ant Manual will be particularly useful.
There should be a dependencies section in NetBeans for your project. You can then add external libraries to your project, such as local JAR files you've got. The best way would probably be to jar up the text files and Arduino directory together, then add that JAR file as a compile-time (and/or run-time) dependency to your project. Now, when you compile your project in NetBeans it should include the specified JAR file on the classpath and voila.
Sorry to not give you more NetBeans-specific direction, I've only used the IDE a couple of times, but all IDEs will allow you to add local JAR files and third-party libraries as dependencies to your project, you just need to find where in the IDE you can do that.
Another idea that might work is to set NetBeans to use your local copy of Java for compilation instead of the one that came bundled with the IDE, that way you don't need to fuss with project dependencies. Again, I don't know where in NetBeans to set this, but start in the General Settings (or perhaps the Project-specific Settings) and find the Java/compilation section; hopefully there's an option to specify which JDK to use, then point it at your local copy.
From Eclipse, I found I can easily export an Ant build file for my project. It provides references to 3rd party libraries and some base targets. I'm using it from my global build file. The only thing that bothers me about this, is that if something is modified in the project structure (like adding a new 3rd party library), we have to think (yes that can be hard sometimes!) about regenerating that build.xml file. I'm wondering if anyone here knows a way to have it updated automatically. By "automatically" I mean that it would not be necessary to explicitly ask Eclipse to regenerate it every time it's needed. I don't know what could be the trigger though...
Any thoughts or knowledge on this?
Thanks!
MJ
Right-click on an Eclipse project then "Export" then "General" then "Ant build files". I don't think it is possible to customise the output format though.
I have been trying to do the same myself. What I found was that the "Export Ant Buildfile" gets kicked off in the org.eclipse.ant.internal.ui.datatransfer.AntBuildfileExportPage.java file. This resides in the org.eclipse.ant.ui plugin.
To view the source, use the Plug-in Development perspective and open the Plug-ins view. Then right-click on the org.eclipse.ant.ui plugin and select import as > source project.
My plan is to create a Java program to programmatically kick off the ant buildfile generation and call this in an Ant file every time I build by adding the ant file to the builders of my projects (Right-click preferences on a projet, under the builders tab).
I've had the same problem, our work environment is based on Eclipse Java projects, and we needed to build automatically an ANT file so that we could use a continuous integration server (Jenkins, in our case).
We rolled out our own Eclipse Java to Ant tool, which is now available on GitHub:
ant-build-for-java
To use it, call:
java -jar ant-build-for-java.jar <folder with repositories> [<.userlibraries file>]
The first argument is the folder with the repositories. It will search the folder recursively for any .project file. The tool will create a build.xml in the given folder.
Optionally, the second argument can be an exported .userlibraries file, from Eclipse, needed when any of the projects use Eclipse user libraries. The tool was tested only with user libraries using relative paths, it's how we use them in our repo. This implies that JARs and other archives needed by projects are inside an Eclipse project, and referenced from there.
The tool only supports dependencies from other Eclipse projects and from Eclipse user libraries.
Take a look at the .classpath file in your project, which probably contains most of the information that you want. The easiest option may be to roll your own "build.xml export", i.e. process .classpath into a new build.xml during the build itself, and then call it with an ant subtask.
Parsing a little XML sounds much easier to me than to hook into Eclipse JDT.
If all you need is the classpath entries, I do something like the following to use the eclipse build path.
<xmlproperty file=".classpath" collapseAttributes="true" delimiter=";" />
Then set that value in the path
<path id="eclipse.classpath">
<pathelement path="${classpath.classpathentry.path}"/>
</path>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}" updatedProperty="compiled">
<classpath refid="eclipse.classpath"/>
</javac>
</target>
I'm the one who donated the Ant export filter to Eclipse. I added the auto export feature, but only to my personal plug-in eclipse2ant, which I still maintain to coordinate bug fixes.
Unfortunately I have no time to merge it to the official Eclipse builds.
Select File > Export from main menu (or right click on the project name and select Export > Export…).
In the Export dialog, select General > Ant Buildfiles as follows:
Click Next. In the Generate Ant Buildfilesscreen:
Check the project in list.
Uncheck the option "Create target to compile project using Eclipse compiler" - because we want to create a build file which is independent of Eclipse.
Leave the Name for Ant buildfile as default: build.xml
Click Finish, Eclipse will generate the build.xml file under project’s directory as follows:
Double click on the build.xml file to open its content in Ant editor:
source