Dave Boden

Ranch Hand
+ Follow
since Nov 08, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Boden

I need to checkout a branch in Eclipse but need to use the -f option so that for any files that aren't branched it fetches the HEAD revision.

I can't see anywhere in Eclipse to configure the checkout of a branch with the user of a -f tag.

Here's what "man cvs" says about the -f option:

-f

When you specify a particular date or tag to cvs commands, they nor-
mally ignore files that do not contain the tag (or did not exist
prior to the date) that you specified. Use the -f option if you want
files retrieved even when there is no match for the tag or date.
(The most recent revision of the file will be used).

Note that even with -f, a tag that you specify must exist (that is,
in some file, not necessary in every file). This is so that cvs will
continue to give an error if you mistype a tag name.



So, any ideas if there's some way that I can pass additional parameters to CVS or configure for this scenario somewhere in the Eclipse options?
The DAO pattern forms part of the core J2EE pattern set.

The DAOFactory is supposed to create a new Dao() rather than the Dao implementing the Singleton pattern.

This feels right to me. However, it does result in lots of objects being created during the running of the J2EE application, probably with no instance variables. I doubt that this takes up many resources and that they are garbage collected easily after the business method has finished with the DAO.

However, you could save any instantiation by using the Singleton pattern for the Dao.

Are there good reasons why not to use the singleton pattern in this way?

One reason that occurs to me is that it would cause confusion when subclassing a Dao. I'd be thinking to myself, "What does the author of the superclass want me to do? Should I make my subclass as singleton too...".

Any others?
The solution involved using the Maven assembly plugin inside the war project.
18 years ago
Oh, by the way. The powers that be have now updated the 1.2.8 project so that it works as I'd expect. I guess that I just got unlucky and picked the week that they were sorting out the release onto ibiblio.

I would still like to see the <type>tld</type> dependencies folded into struts' pom.xml. We could always <exclude> them if we're not building a jsp app with struts (e.g. if we're using velocity or XML/XSLT). I'd imagine that the most common use case is to build jsps... and it doesn't harm the velocity or XML/XSLT approach to have the tld files sitting there anyway.
18 years ago
Maven 2.

I've produced a client jar to be downloaded and run in WebStart. Let's call it client.jar. groupId=myapp artifactId=client

I have another project groupId=myapp artifactId=webapp. This generates a .war file. I want to tell the war plugin to add the client.jar file to the root of the .war package. I don't want to add a <dependency> on the client.jar because this means that it will end up in /WEB-INF/lib. It shouldn't be on the server's classpath... so I don't want it in the lib directory.

I would have thought this was a very general requirement for anyone deploying a WebStart web application using Maven? Is there a way that I can order the war plugin to do the required bundling?
18 years ago
Looks like it may be possible to use variable replacement so that I only need to change the version in one place:

http://maven.apache.org/guides/getting-started/index.html#How%20do%20I%20filter%20resource%20files?
18 years ago
I have a multi-project setup that I want to "Mavenize". The projects depend on each other. I've specified the dependency versions as SNAPSHOT in each of the project's pom.xml files. This works well when I'm working on the head revision of what I have in CVS.

However, I don't understand how things are going to work when it comes to building an older tagged CVS version of the project. Imagine I have a CVS tag called "PROJ-2005-11-01-v2.1.0". How can I tell Maven that I want to build an older version of the project without going through ALL of my pom.xml files and changing SNAPSHOT to the CVS tag? I've got about 15 projects in all, so frequent manual edits would be unworkable.

Moreover, could anyone please describe how Maven 2 interacts with Source Control systems. Maven 1 has an SCM plugin that allows you to checkout files from CVS. What approach does Maven 2 take?

If I get a good answer to this question, I'll take the time to contribute to the Maven documentation:
http://maven.apache.org/guides/mini/guide-multi-module.html
This document is currently empty...
18 years ago
Many thanks for that. I've changed my dependency to 1.2.7 and everything now works as I'd expect.

Shame that there's no Maven 2 plugin that will copy the dependent .tld files into the WEB-INF directory under target as part of the war:war process. I've currently got them checked into my src/main/webapp/WEB-INF directory so that they get copied across.
18 years ago
I'm building a webapp with Maven. At the moment, I've got all my dependencies setup so that I depend on struts, commons-validator, commons-beanutils etc. etc.

I also have to copy the .tld files into my build manually.

Does Struts provide a Maven2 pom.xml setup with the correct dependencies so that I can simply say "I want to depend on struts"? This would:
1. Copy the required .jar files into my target WEB-INF/lib
2. Copy the required .tld files into my target WEB-INF
18 years ago
Thanks for your reply.

So, if I do an:
m2 compile

on Project C (with dependencies setup to A and B in the pom.xml) then it won't work. Which goal can I use to compile C and force a recursive build of A and B which will result in A and B's jar files being updated in the repository.

Surely this is a very common task? I shouldn't have to run 3 commands to acheive this, Maven 2 should be able to work it all out for me.
18 years ago
I have the following project layout
|
|- Project A
|
|- Project B
|
|- Project C

Project C has compile time dependencies on the generated class files of Projects A and B.

I've declared the dependencies in the Maven pom.xml files.

When I run the "compile" goal for Project C, it expects to find the .jar files for Project A and Project B in the repository. How do I configure it so that it looks for the .class files in Project A and Project B? Or have I got the wrong end of the stick, do I *need* to create the Project A and Project B jar files first?
18 years ago
I ended up doing this:



Works nicely. Phew.
18 years ago
I have a dirset called projectDependencies. What I'd like to do is take each of the entries in this dirset and append /classes to it. At the moment, I'm resorting to having another dirset where I've copied and pasted the entries and added /classes. Yuck.

Without using <foreach> or another non-standard tag, is there a way of appending something to every entry in a "path-like structure"?

----

<dirset id="projectDependencies" dir="..">
<filename name="ss_base_shared"/>
</dirset>

<dirset id="projectDependenciesClasses" dir="..">
<filename name="ss_base_shared/classes"/>
</dirset>

<path id="requiredLibraries">
<filelist dir="..">
<file name="SSSharedLibrary/lib/buildandruntime/all_netscape.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/itc.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/jms.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/jnlp.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/junit.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/security_ie.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/tibjms.jar"/>
<file name="SSSharedLibrary/lib/buildandruntime/utils.jar"/>
</filelist>
</path>

<target name="build" depends="init"
description="Builds this project and the projects upon which this project is dependent">
<echo message="Building ${ant.project.name}"/>

<echo message="Building project dependencies..."/>
<subant antfile="build-london.xml" target="build">
<dirset refid="projectDependencies"/>
</subant>

<javac srcdir="src"
destdir="classes"
classpathref="requiredLibraries"
source="1.4"
target="1.4">
<classpath>
<dirset refid="projectDependenciesClasses"/>
<path refid="requiredLibraries"/>
</classpath>
</javac>
</target>

----
18 years ago
You have to write your implementation of DataSource so that it returns a new instance of the InputStream every time getInputStream() is called. You have to read it into a buffer in order to do this. Here's my implementation of InputStreamDataSource which I've tested (it works )

18 years ago
Sorry to spell out the obvious, but you are setting the java.security.policy attribute on the command line, aren't you?
This is what loads the policy file:
java -cp blahblah -Djava.security.policy="c:\mydir\mypolicy.policy" MyClassFile