Re: maven package bloated
On Sat, Aug 28, 2010 at 12:12 PM, mudit tuli wrote: > When I do maven package, this gives me a bloated WAR with all the > dependencies which is 19MB in size. > > For some reasons I need to deploy WAR onto my VPS time and again to test. > > But deploying a 19MB war is time consuming, can I try to strip off the > dependency JARs in the WAR ? > > Tried packaging a skinny war and referenced the the dependency jars with > shared.loader in catalina.properties, is this the right way to do it ? > > Using maven2 and tomcat6. > > Not to mention, I am very new to maven. > Deploying the full war is the right thing to do. But wouldn't it be easier to deploy to a local tomcat before going straight to your VPS? -Dom
Re: Getting from sf.net to central
On Wed, Aug 4, 2010 at 2:06 PM, Benson Margulies wrote: > Does sf.net still lack an approved 'forge' repository for replication > to central? If so, can some kind soul please repost the link to the > new facility at Sonatype for feeding central? > This sounds like what you're after: https://docs.sonatype.com/display/NX/OSS+Repository+Hosting -Dom
Re: XDoc and "&" in a URL...
On 19 Aug 2009, at 18:22, BenoitX wrote: Thanks for your email. There is more to it than what you think... Yes we are using bit.ly but the bit.ly APIs and the javascript way to shorten the current page on-the-fly. So that way StatCVS/StatSVN can put a Twitter button on any page and the current URl will be automatically bit.ly-fied This is explained at http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/shorten And the suggested link by bit.ly for importing the javascript does contain '&' May be we could try to "shortify" that one and use it in our code but that sounds a bit weird... I'll try it... I was just wondering why it seems that the javascript did not login properly... (i.e. any links creaed do not seem to appear under our account... Just one further thought. When you generate the URL containing ampersands, do you see any errors in the firebug console? If you look at the "Net" tab in firebug, does that give you any clue about whether it's downloading OK? -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: XDoc and "&" in a URL...
On 19 Aug 2009, at 16:48, BenoitX wrote: I need to generate an XDOC with a header that contains a link to a javascript. So far, no problem. However, the URL where the code is contains a "&" src="http://bit.ly/javascript-api.js?version=latest&login=statsvn&apiKey=R_2c362b417d0517c27876cbaca1bb68cc "> This causes the xdoc plugin to fail (not valid XML). That's correct behaviour — you have to escape all ampersands in XML in order for it to be well-formed. If I replace this "&" by "&" the xdoc does not complain BUT I end up with & in the html generated and this means that the link does not work as planned... It certainly should do. Which browser is interpreting the link incorrectly? I've tried to read as much a possible on xdoc format... and I tried: 1/ : it fails 2/ end... How could I do this? You can't. You have to escape the ampersand. -Dom
Re: Profile activation based on current plugin?
Sorry — hit send by accident. On 5 Aug 2009, at 14:43, Dominic Mitchell wrote: On 5 Aug 2009, at 14:10, Stephen Connolly wrote: if you think about this a bit more you will realise that what you are asking for does not make sense (unless you are trying to configure the plugin that you are executing. Ok… That does make sense. if you specify a plugin:mojo, then only that plugin:mojo will get executed. Adding other executions of other plugins to a profile and activating that profile will have ZERO effect on what happens, as only the plugin:mojo that you specified will be executed. That's not actually the case. For jetty:run, it executes all phases up to compile before executing jetty:run. Thinking about this, the jetty plugin must be somehow manually be invoking the compile phase. And if I use help:describe, I see: …The plugin forks a parallel lifecycle to ensure that the 'compile' phase has been completed before invoking Jetty. This means that you do not need to explicity execute a 'mvn compile' first… Before this mojo executes, it will call: Phase: 'test-compile' That explains it. try telling us a bit more about what your problem is and perhaps somebody can point you towards a solution but it sounds like you really want maven to be more like ant... maven is not ant, if you want ant use ant ;-) Sorry, I thought I'd been clearer in my original email. I'm trying to avoid calling cocoon:prepare, except in the case of jetty:run. Now I could just not bind cocoon:prepare to the compile phase, but then I have to remember to type two things on the command line. It's not a big deal overall (saving seconds on the non-jetty builds) but it would be nice if I could do it. -Dom
Re: Profile activation based on current plugin?
On 5 Aug 2009, at 14:10, Stephen Connolly wrote: if you think about this a bit more you will realise that what you are asking for does not make sense (unless you are trying to configure the plugin that you are executing. if you specify a plugin:mojo, then only that plugin:mojo will get executed. Adding other executions of other plugins to a profile and activating that profile will have ZERO effect on what happens, as only the plugin:mojo that you specified will be executed. That's not actually the case. For jetty:run, it executes all phases up to compile before executing jetty:run. try telling us a bit more about what your problem is and perhaps somebody can point you towards a solution but it sounds like you really want maven to be more like ant... maven is not ant, if you want ant use ant ;-) Sorry, I thought I'd been clearer in my original email. -Dom -Stephen 2009/8/5 Dominic Mitchell Hi all, I'm wondering — is there a way to activate a profile based on the plugin specified on the command line? The reason for this is that I'm working with a cocoon project. Normally, the cocoon plugin gets bound to compile: org.apache.cocoon cocoon-maven-plugin 1.0.0-M2 prepare compile prepare etc/log4j.xml However, I only really care that this happens when I invoke mvn jetty:run on the command line. Otherwise, it's just wasted effort. I was thinking that I could make this into a profile, but I'm not sure how. Or if that's even possible. Thanks, -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Profile activation based on current plugin?
Hi all, I'm wondering — is there a way to activate a profile based on the plugin specified on the command line? The reason for this is that I'm working with a cocoon project. Normally, the cocoon plugin gets bound to compile: org.apache.cocoon cocoon-maven-plugin 1.0.0-M2 prepare compile prepare etc/log4j.xml However, I only really care that this happens when I invoke mvn jetty:run on the command line. Otherwise, it's just wasted effort. I was thinking that I could make this into a profile, but I'm not sure how. Or if that's even possible. Thanks, -Dom
Re: How to use mvn install but have all options in the pom.xml?
On 30 Jul 2009, at 20:19, jvsrvcs wrote: We do have a maven repository manager in place but it's only accessible inside the network when we are on location. It's trivial to get nexus running on your workstation. I keep one running on my laptop for when I'm not plugged in to our company network. It works like a champ. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [PLEASE TEST] Maven 2.2.0-RC3
On 16 Jun 2009, at 20:08, Nayan Hajratwala wrote: sorry you're having so much trouble, robert -- i just tested 2.2.0- RC3, and it worked fine for me. Good luck on IRC! I agree — I installed 2.2.0-RC3 onto my path a couple of days ago and promptly forgot about it. :) I haven't noticed any changes since, which is a Good Thing™. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: process-sources: process the source code, for example to filter any values.
On 17 Jun 2009, at 08:29, Paolo Castagna wrote: Anders Hammar wrote: > Found this through Google: > http://www.gxdeveloperweb.com/Blogs/Bram-de-Kruijff/Maven-secrets-filtering-sources.htm > > Not sure if it's the best way to do it though. Never tried filtering > java source code. Thanks Anders for your reply. Yep, I've been searching with Google as well and I found the same page, among others. However, I do not need to filter all the sources, just one specific file, which contains version and build timestamp information. As an alternative, one could use Ant via maven-antrun-plugin: I did this a while back and it's been quite successful. http://happygiraffe.net/blog/2008/10/01/embedding-the-maven-version-number/ -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven + Cocoon 2.1.11
On 12 Jun 2009, at 12:57, Martin Gainty wrote: please keep us apprised as many others are (considering a) move to cocoon Just out of interest, why are you considering moving to Cocoon? -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven + Cocoon 2.1.11
On 12 Jun 2009, at 12:42, Armin Ehrenfels wrote: sorry, I don't know of any. As I wrote in my last reply , there was a discussion on the mail lists about how to use maven with Cocoon 2.1.11, but at that time, there were archetypes available for Cocoon2.2 only. You're unlikely to see archetypes for anything on the cocoon 2.1 line. Mostly because you have to rebuild cocoon from source in the first place just to get started. If you want to use maven with Cocoon, you're much better off with 2.2. That said, I did use the maven-ant-tasks to pull in non-cocoon dependencies in a 2.1 project. Whilst it works OK, it's not as nice as proper maven support. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Duplicate class warnings when using shade plugin
On 9 Jun 2009, at 22:00, James Adams wrote: I am building my JAR file using the shade plugin in order to give me an all-in-one JAR artifact which contains all dependency JARs. When I build using "mvn clean install" I always get thousands of message like the following, indicating that there's a duplicate class file in a JAR in the repository, which I assume is coming from the shade plugin when it's doing its thing: [WARNING] We have a duplicate net/sf/cglib/util/StringSwitcher$StringSwitcherKey.class in C:\dev\maven\repository\cglib\cglib-full\2.0.2\cglib-full-2.0.2.jar Is this something I should worry about or is it just an annoyance to live with for now? The resulting JAR artifact works well, maybe this is nothing to worry over, but I want to ask here in case there is something I can fix which will make these warning messages go away. I can't find anything about this using Google, etc. I ran into this with different variations of commons-logging. There's commons-logging (the full jar) and commons-logging-api (JDK14 logging only). But they contain some of the same classes even though they're different artifacts. Different dependencies were pulling in different versions of the same class. In this case, I used a dependencyManagement section to exclude commons- logging-api. But this isn't a general solution. You might not be able to exclude the jar that contains duplicates. That said, the warnings are ignorable. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: 回复: AW: About unittest run three times
On 22 May 2009, at 23:02, Forest wrote: Thanks for your clarification. I really aplied those features. I'd chang the object to only get test report. Are there any suggestions for setting the goals? By the way, are there any good practices for this case? The only thing I'd mention is that I've got two separate hudson jobs: one for the main build, and one for the site build. That way, the tests only get run once in the main build. Of course, that doesn't account for cobertura running them again, as that'd have to be part of the main build… -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [maven 2] assembly: repository from multiple modules
On 15 May 2009, at 22:36, Brian Fox wrote: The dependency:copy-dependencies can also produce a repository layout. Surely some combination of that plus assembly to zip it up should work. It's a good start, but it's not complete. For example, it doesn't include any plugins. Ideally, something like dependency:go-offline, except that it saved everything to a known location instead of the local repository. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Suppressing reports in a profile
On 13 May 2009, at 06:38, Stephen Connolly wrote: have two profiles... first one active by default with all reports defined inside it. second profile is for your clients. when you activate a profile from the cli, that will automatically deactivate any profiles which are active by default Thanks — I had a feeling that you couldn't suppress reports in a profile. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Suppressing reports in a profile
Is there any way to suppress reports in a profile? Normally, I want my site to include a bunch of reports (e.g. findbugs). However, I'm producing an external distribution of the site for 3rd party clients. There, I only want the javadocs and changes reports. I understand that I can use two different profiles, but I was wondering if there is a way to have all reports active by default, and suppress them in the "external" profile? Thanks for any help, -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [PLEASE TEST] Maven 2.2.0-RC2
On 5 May 2009, at 01:02, John Casey wrote: After finding and cleaning up some code that seems to be tainted during some of our efforts at generifying the codebase, we've respun a new release candidate. If you have time, please give it a whirl: https://repository.apache.org/content/repositories/maven-staging-010/org/apache/maven/apache-maven/2.2.0-RC2/ Remember, if you have any problems, report them to: http://jira.codehaus.org/browse/MNG with Affects-Version: 2.2.0 ...then, please reply to this thread to let me know about the issue! :-) I've just noticed this whilst doing a site-deploy: [INFO] Generating "Dependencies" report. Downloading: http://localhost:8081/nexus/content/groups/public/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4.jar Downloading: http://localhost:8081/nexus/content/groups/public/commons-lang/commons-lang/2.1/commons-lang-2.1.jar May 6, 2009 1:58:26 PM hidden.org.apache.commons.httpclient.HttpMethodBase processCookieHeaders WARNING: Cookie rejected: "$Version=0; JSESSIONID=E545E65FB5E46552ED8473D17DF1DC80; $Path=/servlets". Illegal path attribute "/servlets". Path of origin: "/nonav/repository// com.google.collections/jars/google-collections-0.9.jar" May 6, 2009 1:58:30 PM hidden.org.apache.commons.httpclient.HttpMethodBase processCookieHeaders WARNING: Cookie rejected: "$Version=0; JSESSIONID=C39976B35FDA6AAE7A4C267A7DFF61D3; $Path=/servlets". Illegal path attribute "/servlets". Path of origin: "/nonav/repository// com.ibm.icu/jars/icu4j-3.4.4.jar" This wasn't happening on 2.1. Is this just some debug logging left on by accident? -Dom
Re: Best practices for avoiding duplicate configuration files
On 27 Apr 2009, at 21:32, Frédéric Camblor wrote: This is only a point of view but... Isn't the problem coming from the slf4f framework ? I don't really know this logging framework, but it astonishes me that it complains about multiple configuration in the classpath. Generally, framework takes (like commons-logging or log4j) the first config file found in the classpath so that responsibility is delegated to the order in which you put artefacts in your section. Have you searched in slf4j if it isn't possible to "disable" this "complaining" ? That's the whole point of the slf4j. You nail down the implementation you want by specifying it up-front. It seems to be a reaction against the commons-logging façade. http://www.slf4j.org/faq.html#yet_another_facade Don't ask me much more, as I just use log4j. :) -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Repo in parent dir...
On 21 Apr 2009, at 15:05, Stephen Connolly wrote: Last time I checked, setting up Nexus took me 10 minutes and you can run it quite safely on your own desktop... Likewise, I set up nexus on my laptop. It works like a charm, and makes using maven on the road much more pleasant. -Dom - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Mavenizing Existing Project Part Deux
On 25 Feb 2009, at 14:40, Steve Cohen wrote: I am thinking about this very carefully, and the option of not using Maven at all is still in play. So is the option of using Maven ONLY to grab third-party dependencies into a local repository. I did this the other day, using the maven-ant-tasks to manage dependencies of an ant based project. I've written a POM and a minimal ant script, which collaborate to download all dependencies from our internal repo. It works like a charm, given that this project can't be converted to maven wholesale yet (it's cocoon 2.1, and would need to be migrated to 2.2). -Dom
Re: POM Best Practice? Tomcat, svn wc, and dists
On 12 Feb 2009, at 15:39, Lee Goddard wrote: As Gérald said, you should keep your source and compiled artifacts separate. Oh yes, sounds like a very good idea. No argument from me! The maven standard (which seems reasonable to me) is that java source code lives under src/main/java. Additional non-java files you want to end up in your classpath (i.e. WEB-INF/classes) go into src/main/resources. When you run "mvn package" everything will get copied into place, then packaged up into target/myproject-0.1.war (or similar). I can see the sense of that, just that it seems rather distribution- dependant to me: I can more productive if I can regularly build a distribution in situ. This is why I added Tomcat to the subject line -- surely people aren't copying files and directories around to make distributions? Perhaps I should be looking at configuring my dev Tomcat to read fromt eh Maven-ised project structure? That just seems feel. I feel I am missing a vital piece of the puzzle, but no-one have spoken to in the real world seems to have it -- possibly because they rely on Eclipse and I don't, or perhaps because their jobs involve installing distributions of the software, whereas mine involves writing the software I think it is the case that most people who use Maven will be using a Java IDE of some sort. These take care of ensuring that the right files are seen by the web server at the right time. Generally, though it's fairly normal (when outside of an IDE) to package the software before letting tomcat (or any other servlet container) at it. If you really want tomcat to serve your files directly, you can configure it (in conf/Catalina/localhost/myproj.xml) to point directly at …/myproj/src/main/webapp. I'd say that this isn't a particularly normal usage scenario though. -Dom
Re: POM Best Practice? Tomcat, svn wc, and dists
Hi, Lee! On 12 Feb 2009, at 15:08, Lee Goddard wrote: I am a new user of Maven, but have some experience of building Perl and C distributions. I hesitate to draw comparisons between maven and ExtUtils::MakeMaker. :-) I have a simple Tomcat Servlet project checked into SVN just as it sits in Tomcats default webapp/ dir: My_project / WEB-INF / classes / my_company/ my_library.java lib/ my_depends.jar web.xml I've been asked to copy and paste those into the structure produced by the default maven archetype (if the terms are right). I think I understand that My_project/WEB-INF/lib will become Maven dependencies. Is it possible to set my POM to use build/sourceDirectory to point to My_pojrect/WEB-INF/classes? Would that be a bad idea? Is it frequently/never done that way? As Gérald said, you should keep your source and compiled artifacts separate. The maven standard (which seems reasonable to me) is that java source code lives under src/main/java. Additional non-java files you want to end up in your classpath (i.e. WEB-INF/classes) go into src/main/resources. When you run "mvn package" everything will get copied into place, then packaged up into target/myproject-0.1.war (or similar). Whilst you can make maven look in other places for the source code, it's usually better in the long run to stick with the defaults. Once you've got a couple of projects with similar structures, it makes moving between them much easier. All thoughts or directions to the manuals appreciated. I am sure this must be covered somewhere, but I am asking your help to try to get up-and-running with Maven as quickly as possible. Probably your best bet for now is to check out the online edition of Maven: The Definitive Guide. There's a lot in there, but the first few chapters should get you over the hump fairly quickly. -Dom
Re: Maven + Junit 4.5 dependency does not work
On 29 Oct 2008, at 20:14, Petr V. wrote: I must be doing some thing very silly :-( I'm afraid so. This caught me out. :( public class AppTest extends TestCase In JUnit 4, you don't extend TestCase. Instead, you should "import static org.junit.Assert.*" to get at the assertions. If you extend TestCase, JUnit will run the test with the JUnit 3.8 runner, which will ignore the annotations. -Dom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing project version number from Java
On 29 Sep 2008, at 13:22, Mark Hobson wrote: 2008/9/29 Dominic Mitchell <[EMAIL PROTECTED]>: What's the easiest way to get at the version number in the POM from Java? I've been using getResourceAsStream('META-INF/maven/groupId/artifactId/ pom.properties'); But this doesn't work while I'm developing in Eclipse (only when using the built jar file). You can use maven-runtime to dynamically obtain this information, but it still has the limitation of requiring the META-INF files created at package-time: http://maven.apache.org/shared/maven-runtime/ Aha! Thanks for pointing this out. That's much more useful than rolling my own implementation of such a thing. I'd quite like to see the generation of these metadata files occur at the generate-resources phase of the lifecycle which would allow it work within the IDE too. -Dom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing project version number from Java
On 29 Sep 2008, at 13:08, Brett Porter wrote: 2008/9/29 Dominic Mitchell <[EMAIL PROTECTED]>: What's the easiest way to get at the version number in the POM from Java? I've been using getResourceAsStream('META-INF/maven/groupId/artifactId/ pom.properties'); But this doesn't work while I'm developing in Eclipse (only when using the built jar file). Yes, this is only generated when the JAR is packaged. It might be best for your test cases to substitute in a known value here rather than relying on it, unless you are doing something specific with the version. There's nothing particularly important about this — it's just a minor annoyance. We already substitute "[dev]" if we can't read it. Ideally, I'd like to somehow generate a Java class which contains the version number. I thought I should be able to do this using resource filtering, but I couldn't see a way to configure the resources plugin to achieve this… @project.version@ should be substituted in a copy, but resources are processed after compilation so the timing is not correct. You'd need to execute a specific plugin in the generate-sources phase. I'll have a play with this to see if I can get it to do what I want. Thanks for your quick response! -Dom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Accessing project version number from Java
What's the easiest way to get at the version number in the POM from Java? I've been using getResourceAsStream('META-INF/maven/groupId/artifactId/ pom.properties'); But this doesn't work while I'm developing in Eclipse (only when using the built jar file). Ideally, I'd like to somehow generate a Java class which contains the version number. I thought I should be able to do this using resource filtering, but I couldn't see a way to configure the resources plugin to achieve this… Any help would be most gratefully appreciated. Thanks, -Dom