Re: How access classes from war dependency?
On May 5, 2011, at 2:44 PM, sipungora wrote: > I've done this, as you've explained me here. But I have one problem yet. If > I save data in jar object from 1-st war for the 2-nd war, the 2-nd war > cannot acces they. My object is the singleton. > > 1 protected static Controller controller; > 2 > 3 public static Controller getInstance() { > 4 if(controller == null) { > 5 controller = new Controller(); > 6 } > 7 return controller; > 8 } > > If I debug 1-st war and then 2-nd one, I see that 2-nd war also goes into > row 5. So both wars works with different objects. > Can you explain me how can I solve this? I don't think you can do this. I think each war is in its own class loader; effectively each web application is in its own space. There may be ways to configure your app server to share information between wars, but frankly the whole concept smells of bad design. -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Dynamically generating class names with archetype
On Apr 19, 2011, at 3:05 PM, Ryan Connolly wrote: > Hi have you defined these properties in an archetype descriptor? > > http://maven.apache.org/guides/mini/guide-creating-archetypes.html According to the documentation at: http://maven.apache.org/archetype/archetype-common/archetype.html the only elements supported by are , , , , , and . Where would I put the definitions of those properties? -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Dynamically generating class names with archetype
I'm building an archetype for generating Maven projects for our custom application framework. Everything is working but the generated project always has the same class names and annotations. I would like to be able to dynamically specify those names/annotations. For example, I can specify my Java file (src/main/resources/archetype-resources/src/main/java/ClientApp.java) like this: package ${packageName}; // imports go here... @OurAnnotation(client="Client", application="ClientApp", version="1.0.0-SNAPSHOT") public class ClientApp extends OurBaseClass { ... } but what I'd like to do is something like this: package ${packageName}; // imports go here... @OurAnnotation(client="${client}", application="${clientApp}", version="${clientAppVersion}") public class ${clientApp} extends OurBaseClass { ... } I tried the above and using: mvn archetype:generate -DarchetypeGroupId=... -DarchetypeArtifactId=... -DarchetypeVersion=... -Dclient=Acme -DclientApp=HelloWorld6 -DclientAppVersion=1.0.0-SNAPSHOT -DgroupId=net.interactions.example -Dversion=0.0.1-SNAPSHOT -DartifactId=hello-world-6 my generated ClientApp.java file had the correct package name (net.interactions.example), but none of the other substitutions were performed. Also, I'd need the generated file itself to have the correct name (${clientApp}.java). I'd have preferred that the generated file be named "HelloWorld6.java" and have the content: package net.interactions.example; // imports go here... @OurAnnotation(client="Acme", application="HelloWorld6", version="0.0.1-SNAPSHOT") public class HelloWorld6 extends OurBaseClass { ... } Is what I want to do possible? -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Test phase for a command line tool (resend)
Note: I sent this on Friday (2011-03-18) but saw no response, so am resending on the chance that it somehow got lost in transit. Caveat: I am new to Maven. I've read the online documentation but haven't found a good source of sample POMs other than for very basic configurations. I have a POM that builds a command-line tool. I figured out how to use the assembly plugin to build a self-contained jar, but now I need to be able to run a series of test cases using that jar and a custom shell script to invoke it. I have several questions: 1) Where do I put my custom shell script in the hierarchy? I've put the source into src/main/bin for now. 2) For testing I'd like to copy the shell script and self-contained jar (jar-with-dependencies) to a test directory (similar to test-classes) and run the jar from there. How do I do that? 3) The command-line tool analyzes compiled Java code from a jar and builds an XML file from the analysis. What I'd like to do for my test cases is compile a bunch of different tests into different jars, then for each jar run the tool over it, generating an XML file, and do a diff on the XML file against expected output. How do I do that? 3a) Alternatively I could write a test application that used Runtime.exec() to run the tool for each test case, then read in the resulting XML files using an XML parser and made a bunch of assertions about each file, but frankly I'd rather avoid writing the extra code. If I need to, however, how would I do that? I don't necessarily need the actual POMs written for me; pointers to more complete samples doing similar tasks would be fine. Thanks in advance. -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Test phase for a command line tool
Caveat: I am new to Maven. I've read the online documentation but haven't found a good source of sample POMs other than for very basic configurations. I have a POM that builds a command-line tool. I figured out how to use the assembly plugin to build a self-contained jar, but now I need to be able to run a series of test cases using that jar and a custom shell script to invoke it. I have several questions: 1) Where do I put my custom shell script in the hierarchy? I've put the source into src/main/bin for now. 2) For testing I'd like to copy the shell script and self-contained jar (jar-with-dependencies) to a test directory (similar to test-classes) and run the jar from there. How do I do that? 3) The command-line tool analyzes compiled Java code from a jar and builds an XML file from the analysis. What I'd like to do for my test cases is compile a bunch of different tests into different jars, then for each jar run the tool over it, generating an XML file, and do a diff on the XML file against expected output. How do I do that? 3a) Alternatively I could write a test application that used Runtime.exec() to run the tool for each test case, then read in the resulting XML files using an XML parser and made a bunch of assertions about each file, but frankly I'd rather avoid writing the extra code. If I need to, however, how would I do that? I don't necessarily need the actual POMs written for me; pointers to more complete samples doing similar tasks would be fine. Thanks in advance. -- Rick Genter rgen...@interactions.net *** This e-mail and any of its attachments may contain Interactions Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Interactions Corporation. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete the original and any copy of this e-mail and any printout. Thank You. *** - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org