This question already has an answer here:
How to include directory structure in an ant jar file?
(1 answer)
Closed 8 years ago.
I am newbie to ant and I want to include entire directory to the jar file which is creating using ANT ? Can anyone give a idea for me. thanks
Have you checked Jar Task documentation? It has a lot many examples that would be helpful to you. A very short example might me like this:
<jar jarfile="${dir.dist}/jarfile_name.jar">
<fileset dir="${dir.build}"
includes="**/*.class"
excludes="**/UnitTest*.class"/>
<fileset dir="${dir.src}"
includes="**/*.properties"/>
</jar>
Here's an example from java2s
Related
my project is VaadinFramework based project.I was run build.xml file through jenkins.
i struck with error like this.
/build.xml:28: impossible to resolve dependencies:
java.lang.IllegalArgumentException: a module is not authorized to depend on itself: com.vaadin.external.atmosphere#atmosphere-compat-jbossweb;2.0.1-vaadin1,
if you know the answer please help me out
the above three addons i was added in ivy.xml file.my problem was salved.
Becouse my project is vaadin based project.so it using vaadin dependencies in compile and runtime.
anyhow im also looking otherways to soughtout this problem inspite of addons.
This question already has answers here:
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter when starting Simple Struts2 Application
(3 answers)
Closed 6 years ago.
I got this error when starting the app.
SEVERE: Exception starting filter struts2 java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
and the server gave this error twice in a row.
I have struts2-core-2.3.15.2.jar in WEB-INF/lib and imported into build path. I do not understand why StrutsPrepareAndExecuteFilter cannot be found.
The application can get started. thats no problem. the problem is because of this error, struts2 cannot redirect the action.
I use tomcat 7 and struts2 2.3.16. It's Tomcat 7, the servelet-api is not 3.0 I guess. I tried to put servelet-api-3.0 in tomcat/lib but it's not compatible.
What's the problem?
Jars used:
The following minimum jars should be on your classpath:
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
commons-fileupload-1.3.jar
commons-io-2.2.jar
commons-lang3-3.1.jar
commons-logging-1.1.3.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
log4j-1.2.17.jar
ognl-3.0.6.jar
struts2-core-2.3.16.jar
xwork-core-2.3.16.jar
You can also follow How To Create A Struts 2 Web Application.
the runtime problem was solved eventually by replacing the json jars package.. i think its the versions problems. it is a whole package. i dont remember the link now..
so it seems its better get the jar files from one source but not pick different version.. and these 6 jars should be included together. of course, be careful with the versions. i dont know mine. but it works.
commons-lang.jar
commons-logging.jar
commons-beanutils.jar
commons-collections.jar
json-lib-2.2.2-jdk15.jar
ezmorph.jar
BUT this problem is still there... I have this error, but the app can run
java.lang.ClassNotFoundException:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
If you use Intellij IDEA, the reason maybe you did not add struts-xxx.xxx.jar file to artifacts.To solve this problem you just need open Project structure >> problems >> add struts x.x.x to artifacts(righit click on the problem option)
It works for me ,may it helps you.
If you are using external JRE, it may not work.
Instead use the internal JRE (which is inside JDK)
In the project
Go to Build path
-->Configure Build path
-->Libraries
-->Add Libraries
-->Installed JRRs
--> Give path of "JDK"(and not external JRE)
-->Finish.
Refresh the project and it would work.
I am preparing a release for an application using rebar, and I wonder what is the usual way to include header file from standard library. In my case, it is the wx.hrl file, which is included with its full absolute path in my code.
I guess that it is not the right way :o)
-include_lib("wx/include/wx.hrl").
This makes the preprocessor look for the latest version of the wx application in the code path. See this question for more details.
We have a file set in our Ant build which looks like this:
<fileset dir="somewhere/lib" includesfile="third-party-jars.txt"/>
Every jar is then spelled out in full in the text file. (The reason we have it in a separate text file is actually nothing to do with build file brevity, but rather so that it's easier to inspect the list from an integration test we have which checks that all third-party jar file licences are documented.)
Someone made a commit which prevented a file going into the build. Ant didn't pick up the missing file at all - the build proceeded. It seems bad that even though the file names are spelled out in full, a file being missing isn't detected... so I'm trying to solve that now.
There is an attribute for erroronmissingdir, but adding it doesn't help (the dir isn't missing.) Is there a way to get an error on missing files in a fileset? Ideally a compact way... because we have more than one of these filesets and duplicating code doesn't sound appealing.
Other people have asked simpler variants of this where they wanted to check a single file. To check a single file, you use the available task. It seems like available only supports one resource though.
I took a shot at restricting the resource collection to try and find available vs. unavailable resources.
<restrict id="temp.available"><resources refid="#{ref-name}"/></restrict>
<difference id="temp.unavailable">
<resources refid="#{ref-name}"/>
<resources refid="temp.available"/>
</difference>
<fail message="Missing stuff">
<condition>
<resourcecount refid="temp.unavailable" when="greater" count="0"/>
</condition>
</fail>
This doesn't work, seemingly because the resource collection is already missing the items which don't exist.
What you are asking for is impossible to get with the native fileset support. fileset works as a scanner: it is based on a particular directory, and includes all files according to the inclusion/exclusion patterns you provide. Even erroronmissingdir wasn't a part of fileset until Ant 1.7 or so.
Your best bet is to write a macro around the available task, passing a resource collection to the macro and use a for loop (from Ant-Contrib) to test the availability of each file.
Where to find it?
All the following are using xdoclet - a sensible way to build ejb 2 apps:
http://www.ericsson.com/developer/sub/open/technologies/open_development_tips/docs/odt_xdoclet_test
http://www.liuzehua.com/xdoclet_tutorial/
http://onjava.com/pub/a/onjava/2002/01/30/xdoclet.html
ALl of them are articles which you can download the source code.