Webapp classpath issues in multi-module project
Hi, We have a Maven project that is laid out as ./domainModule ./serviceModule ./baseModule (with parent pom) ./webAppModule ./module4 We can successfully generate eclipse projects for the module using mvn eclipse:eclipse from the baseModule which sets up the classpath correctly in eclipse with the separate eclipse projects depending on each other correctly. The classes in the webAppModule are able to see the classes from other modules within the development environment. However when we try to run the webapp within Eclipse, we get ClassNotFoundExceptions when the code attempts to reference our classes which are in the domainModule or serviceModule. Strangely enough if I run mvn eclipse:eclipse from the webAppModule directory so that the eclipse project has dependencies on the snapshot jars in the local repo then the exact same code in the webAppModule works fine. It seems the problem is to do with eclipse resolving the classpath dependencies on other projects, not really a Maven issue but I'm at a loss as to where else to pose this question. Any ideas? I'm using eclipse 3.4 I've configured wtp as follows: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-eclipse-plugin/artifactId configuration downloadSourcestrue/downloadSources wtpversion2.0/wtpversion /configuration /plugin Cheers, Ian
Re: Problem while building using Maven
There is a very quick tutorial on the Maven site which should get you up and running with a very basic pom file and standardised directory structure. You can find it here: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html You don't actually need a settings.xml file to run Maven so I would suggest that you delete/move the one you have created and go through the tutorial. Once you have finished that you will have a Maven project which will retrieve your dependencies from the main Maven site. It will then be easy to create a settings.xml file to use your Nexus repository. If you have problems, you will need to post the details of the error message that you receive. On Mon, Apr 20, 2009 at 6:54 AM, MS21 subramanian.me...@wipro.com wrote: Hi Ian,n' We have a Nexus software installed, created a local repostiory and added some basic artificats . I am new to Maven so trying to configure a simple project and point it to this repository. Could you pls let me know the steps or give URL which contains these details. Ian Petzer wrote: Hi, Could you please post the details of the error message that was displayed. Also, please attach your settings.xml file. Ian On Fri, Apr 17, 2009 at 3:03 PM, MS21 subramanian.me...@wipro.com wrote: Hi, We are new to Maven and trying to build a project , it shows Not able to download from the URL. I am not really sure if its a proxy issue, though the network we were using does not have any proxy user ids for that. We actually tried changing the settings.xml and pointed it to maven2 repos (http://repo1.maven.org/maven2/). Later we changed it to our local repository URL. But when we run it it was saying cannot download from the URL.- http://repo1.maven.org/maven2/ We are not sure if its still pointing to the old URL or internally it uses Maven url. Could you pls guide us.. -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23098266.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23130747.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Problem while building using Maven
Hi, Yes indeed. If your Nexus instance is correctly configured and you are pointing Maven at it correctly then the artifacts corresponding to the dependencies listed in your pom should be downloaded and put in your local repository. 1) Can you confirm whether you have added a dependency to your pom which includes the commons codec classes that you are using? 2) Can you please attach a copy of your settings.xml file 3) With regards to these artifacts that you have installed, are they publicly available jars which can be found on the central repo or jars that you have created yourself? 4) If you run 'mvn -U compile' it forces a check for updates on your dependencies. What output do you get when you do this? Is it able to succesfully connect to your Nexus instance? On Mon, Apr 20, 2009 at 9:43 AM, MS21 subramanian.me...@wipro.com wrote: This i have tried and its working. What i am trying to do is i have created a repository in NEXUS http://localhost:8080/nexus-webapp-1.3.2/content/repositories/IBRepos/ I have added couple of aritifacts in this (jar files). and using the classes from this artifact I modified the POM and settings.xml in my sample to point to this..When i build, its giving compilation error since its not in build path (this one i will fix)..Also i think it shud download the artificats to local repository under M2 folder.. but this is not happening.. Pls confirm --- [INFO] Compilation failure C:\sample-echo\FileManager\src\main\java\org\xh\studies\App.java:[3,32] package org.apache.commons.codec does not exist Ian Petzer wrote: There is a very quick tutorial on the Maven site which should get you up and running with a very basic pom file and standardised directory structure. You can find it here: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html You don't actually need a settings.xml file to run Maven so I would suggest that you delete/move the one you have created and go through the tutorial. Once you have finished that you will have a Maven project which will retrieve your dependencies from the main Maven site. It will then be easy to create a settings.xml file to use your Nexus repository. If you have problems, you will need to post the details of the error message that you receive. On Mon, Apr 20, 2009 at 6:54 AM, MS21 subramanian.me...@wipro.com wrote: Hi Ian,n' We have a Nexus software installed, created a local repostiory and added some basic artificats . I am new to Maven so trying to configure a simple project and point it to this repository. Could you pls let me know the steps or give URL which contains these details. Ian Petzer wrote: Hi, Could you please post the details of the error message that was displayed. Also, please attach your settings.xml file. Ian On Fri, Apr 17, 2009 at 3:03 PM, MS21 subramanian.me...@wipro.com wrote: Hi, We are new to Maven and trying to build a project , it shows Not able to download from the URL. I am not really sure if its a proxy issue, though the network we were using does not have any proxy user ids for that. We actually tried changing the settings.xml and pointed it to maven2 repos (http://repo1.maven.org/maven2/). Later we changed it to our local repository URL. But when we run it it was saying cannot download from the URL.- http://repo1.maven.org/maven2/ We are not sure if its still pointing to the old URL or internally it uses Maven url. Could you pls guide us.. -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23098266.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23130747.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23132545.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Problem while building using Maven
What do you change in the code to make it stop working? Could you include a full transcript of what Maven logs when you encounter this error? Also, do you need to use that proxy you have defined in the settings.xml? One more thing, in your pom.xml you have defined your repo, but you have defined it again in the settings.xml file in a profile called 'dev'. Do you only want to use this repo under certain conditions or do you want to use it the whole time? On Mon, Apr 20, 2009 at 11:25 AM, MS21 subramanian.me...@wipro.com wrote: I am attaching the settings.xml and POM.xml. These are std jar's which are available in maven2 repos. i just added some common-code, avalon framework into my repository for testing purpose. Do i still need to declare dependencies.. I ran mvn -U command and it shows build successfull. It behaves differently if i try to change the code and package again Could you pls guide me on this. http://www.nabble.com/file/p23134095/pom.xml pom.xml http://www.nabble.com/file/p23134095/Copy%2Bof%2Bsettings.xml Copy+of+settings.xml -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23134095.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Problem while building using Maven
Hi, Could you please post the details of the error message that was displayed. Also, please attach your settings.xml file. Ian On Fri, Apr 17, 2009 at 3:03 PM, MS21 subramanian.me...@wipro.com wrote: Hi, We are new to Maven and trying to build a project , it shows Not able to download from the URL. I am not really sure if its a proxy issue, though the network we were using does not have any proxy user ids for that. We actually tried changing the settings.xml and pointed it to maven2 repos (http://repo1.maven.org/maven2/). Later we changed it to our local repository URL. But when we run it it was saying cannot download from the URL.- http://repo1.maven.org/maven2/ We are not sure if its still pointing to the old URL or internally it uses Maven url. Could you pls guide us.. -- View this message in context: http://www.nabble.com/Problem-while-building-using-Maven-tp23098266p23098266.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Delete the static files using maven
Hi Sam, Have you considered using the antrun plugin to perform the delete? You can configure the plugin in your pom.xml and bind it to a lifecycle phase that runs before Maven compiles your code. Info on configuring the antrun plugin can be found here: http://maven.apache.org/plugins/maven-antrun-plugin/usage.html Here is some info on the Ant delete task: http://ant.apache.org/manual/CoreTasks/delete.html Ian On Fri, Mar 6, 2009 at 12:21 PM, SRINIVASA RAO srinivasv_amb...@yahoo.comwrote: Hi, Could any have example POMs on delete the static files from specific location using Maven. After deleting this files, i need to compile the code . I can achieve the second task , after deleting files manually. But i want to do the delete files are automatically. Could any give me solution on this. It will be great help to me. Regards, Sam
Re: Functional Test strategies with Maven
Hi Martin, What is the reasoning beyond the separation of the functional tests? Is it because you would like to run them separately from your other unit tests? If so, have you considered using profiles to control what tests are run by Maven? If not, what goal are you trying to obtain by putting them in a separate area? Ian On Mon, Mar 2, 2009 at 3:33 PM, martijnverb...@gmail.com wrote: Hi all, I'd like to get opinions from others on how they structure/deal with what we deem 'functional tests' To us these are tests that are broader in scope than a unit test but whose scope is still limited to that same module and require no 3rd party resources to run (we're able to Mock everything we need). Traditionally a Maven structure looks something like: foobar jar src main java test java war ... sar ... rar ... ear With the 'test' structure being used for Unit Tests. So we're wondering if it was wise to put the functional tests under jar--test--src--java (perhaps differentiating them by package structure) or introduce a new module (say functional-test) eg foobar jar src main java test java functional-test src test java war ... sar ... rar ... ear ... Is there a preferred technique/other options that people have used?
Re: Re: Functional Test strategies with Maven
Are these functional tests invoked as jUnit / TestNG tests? I have written similar, integration type functional tests with mocks, but they were still based on jUnit / TestNG. I simply stored them in the same module name--test--src--java are being used for unit tests. I differentated between the two sets through the package names and used profiles to run these optionally. My reasoning was that its easiest to stick with the vanilla Maven directory structure as it is a standard. This approach certainly worked for me at the time. I guess that would be my suggestion. ps: I think you replied directly to me, rather reply to the group email address. On Mon, Mar 2, 2009 at 4:08 PM, martijnverb...@gmail.com wrote: Hi Ian, What is the reasoning beyond the separation of the functional tests? Is it because you would like to run them separately from your other unit tests? If so, have you considered using profiles to control what tests are run by Maven? The specific purpose in this case is to ensure that we've wired up messaging flow(s) within our module. This is done by sending a mocked event through the various routers/transformers etc that we have. They're not unit tests because they're not testing a discrete bit of functionality within a Java class. However, it is vital that these tests pass before we package that module, so I we want to run them as part of a the test life-cycle (as opposed to integration-test which is post package) or at least a life-cycle phase that is before package. I agree that we could use profiles to run this group of tests separately, but I'd like to understand where they should live in the source structure. All of the Maven literature that I have read talks of module name--test--src--java being used for unit tests, but tests such as mine fall into a grey area? Cheers, Martijn On Mon, Mar 2, 2009 at 3:33 PM, martijnverb...@gmail.com wrote: Hi all, I'd like to get opinions from others on how they structure/deal with what we deem 'functional tests' To us these are tests that are broader in scope than a unit test but whose scope is still limited to that same module and require no 3rd party resources to run (we're able to Mock everything we need). Traditionally a Maven structure looks something like: foobar jar src main java test java war ... sar ... rar ... ear With the 'test' structure being used for Unit Tests. So we're wondering if it was wise to put the functional tests under jar--test--src--java (perhaps differentiating them by package structure) or introduce a new module (say functional-test) eg foobar jar src main java test java functional-test src test java war ... sar ... rar ... ear ... Is there a preferred technique/other options that people have used?
Re: example for settings.xml
Ratna, Now that you have a better understanding of the settings.xml file, I would recommend that you specify a mirror for the main maven site that is located close to you geographically. Encourage the rest of your team to do the same, or even think about putting in a local repository for your organisation. Your Maven will run faster due to a lower latency connection and you'll be less load on the Maven servers. Ian On Sun, Mar 1, 2009 at 7:21 AM, nani2ratna nani2ra...@gmail.com wrote: Hi, Thank you very much for your replies. Actually i didnt understand properly about settings.xml. I didnt put anything in that file. Thats why it was not working. I went through some forums then i put the default values. Now its working fine. Thank you very much for giving these replies. Thanks and Regards Ratna Sekhar Ian Petzer wrote: Hi Ratna, To be honest you don't really need much of anything in a settings.xml file. The defaults are enough to get Maven working. I actually run with a settings.xml file that looks much like the snippet below You could create your own settings.xml file like this but I doubt it would solve your problem. Maybe you should paste your error message that you get: - settings xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd; mirrors /mirrors servers /servers /settings --- On Sat, Feb 28, 2009 at 10:35 PM, nani2ratna nani2ra...@gmail.com wrote: Hi, I am new user to maven. I installed maven perfectly. I did first hello world perfectly. Now i want to create a project for struts and hibernate. Then i gave command to generate folder for web application. It also worked fine, now i put struts in dependency. But its giving error that settings.xml is not working. I want to start developing with struts very new version 2.1.6 GA. So can please send me the proper settings.xml. Thanks and Regards Ratna - View this message in context: http://www.nabble.com/example-for-settings.xml-tp22267685p22267685.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- View this message in context: http://www.nabble.com/example-for-settings.xml-tp22267685p22270551.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Un-mavenize a Maven2 project ?
Hi Alessio, A possible solution to your problem that would allow you to keep your mavenised project and isolate your students from Maven would be: 1) Generate an eclipse project using Maven 2) Create a lib folder in your project structure (at the same level as src) 3) Manually or automatically copy the the project dependencies from your local repo into the lib folder (maintaining their relative directory structures) 4) Distribute the project to your students. Each of them will have to use the 'Import existing eclipse project' option to get it into their workspace. 5) All of the project dependencies are mapped relative to the M2_REPO variable, so your students would have to create this variable and then point it at the lib folder containing the dependencies. By this point they should be up and running and ready to code. I haven't tried this but I think it should work fine. You could also distribute the lib folder seperately to the project if you preferred that. Ian On Fri, Feb 27, 2009 at 6:44 PM, Mark Struberg strub...@yahoo.de wrote: but ant must be installed also before it can be used. And installing ant is the same effort than installing maven. So this will not add anything to his problem. LieGrue, strub --- David Weintraub qazw...@gmail.com schrieb am Fr, 27.2.2009: Von: David Weintraub qazw...@gmail.com Betreff: Re: Un-mavenize a Maven2 project ? An: Maven Users List users@maven.apache.org Datum: Freitag, 27. Februar 2009, 19:18 Would Ant be okay to use? You don't have to demavenize a thing -- just add a build.xml to your project. We converted many of our projects from Ant to Maven, but still have both the build.xml and pom.xml in the root directory. I even removed the third party jars from our repository. Instead, I added Ant's get task to the build.xml to fetch the needed jars. It is up to the tech leads to decide whether to use Maven or Ant in our continuous build process although more and more projects are now being built with Maven. Then again, installed Maven, set the settings.xml in the Maven directory, then tarred it up and pass it out to the students. It's pretty self contained. All they need to do is untar it somewhere, and put a link to the mvn script into their PATH. That will allow the students to learn Maven while they are at it. Might as well let your students learn how to use Maven now while their brains are still soft and moist rather than wait a few years after brain hardening has started to set in. On Fri, Feb 27, 2009 at 2:19 AM, Alessio Pace alessio.p...@gmail.com wrote: Hi, a project I'm working on is built by Maven2. It is a single module, it uses M2 merely for dependency managament. I have to let some students play with it as part of a lab project. Their machines just have plain Eclipse, and the users are Maven-unaware, and I can't afford to make them pre-install Maven or install it during the lab session (too few hours). What I wanted to do is to un-mavenize the project, creating a separate source tree in the old fashion: without the pom.xml but with a libs directory filled with all the jars my project depends on. Possibly also with the Eclipse .project and .classpath files already configured (ok ok, this is optional). Thanks in advance for any suggestion on how to achieve that, or with comments if you ever had to deal with such a situation (and possibly if you want me to discourage to go with the un-mavenize process) Regards, Alessio Pace. -- -- David Weintraub qazw...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: example for settings.xml
Hi Ratna, To be honest you don't really need much of anything in a settings.xml file. The defaults are enough to get Maven working. I actually run with a settings.xml file that looks much like the snippet below You could create your own settings.xml file like this but I doubt it would solve your problem. Maybe you should paste your error message that you get: - settings xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd; mirrors /mirrors servers /servers /settings --- On Sat, Feb 28, 2009 at 10:35 PM, nani2ratna nani2ra...@gmail.com wrote: Hi, I am new user to maven. I installed maven perfectly. I did first hello world perfectly. Now i want to create a project for struts and hibernate. Then i gave command to generate folder for web application. It also worked fine, now i put struts in dependency. But its giving error that settings.xml is not working. I want to start developing with struts very new version 2.1.6 GA. So can please send me the proper settings.xml. Thanks and Regards Ratna - View this message in context: http://www.nabble.com/example-for-settings.xml-tp22267685p22267685.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Mavenizing existing project
Hi Steve, I use Maven for building my projects and the eclipse WTP plugin as well. JSP re-compilation while running and hot swap code replacement while debugging has always worked for me. On Sun, Feb 22, 2009 at 5:21 PM, Steve Cohen sco...@javactivity.org wrote: Thanks Stephen: I figured there would always be one manual deployment step but I would like to at least get rid of the post-eclipse export, pre-deploy manual steps. I have one more question I meant to ask earlier but forgot. I do make use of the Eclipse WTP environment and a local Tomcat server and immediate compilation to create a rapid-turnaround development environment apart from the server. This dovetails pretty nicely with the regular Eclipse export. Is it possible to still do this when Maven is running the show? Stephen Connolly wrote: 2009/2/22 Steve Cohen sco...@javactivity.org I am consideringMavenizing a pre-existing project. This project consists of a Web Application (WAR file) and a server side JAR module, built from several Eclipse projects, some of which are dependencies of both modules, as well as many third party jars, both open source (many of which themselves use Maven, of course) and proprietary. Current build process is very rudimentary. The Eclipse projects do not currently use Maven naming standards for directories. To do builds, the simple Eclipse Export menu options are currently used. Deployment is manual and there are FYI, maven's lifecycle says *nothing* about deploying post release. When maven talks about deploying, this is deploying the released artifacts to a Maven repository. There are maven plugins to deploy your war to tomcat, jetty, etc... but they are not part of the lifecycle... I think you will always end up with a manual deployment step (even if that is running a maven mojo in tomcat-maven-plugin, cargo-maven-plugin, jetty-maven-plugin, etc) And your customers will have the same... On the other hand, if deployment is for integration testing, then maven can do even better, with the ability to start and stop the app server before and after the integration tests (as part of the lifecycle). Some aspects of the maven support for this are poorer than they could be though. some annoying manual post-export tasks that must be run. Version control uses subversion, including a big ugly project containing static copies of binary jars. These are my main reasons for considering conversion to Maven. Questions: 1. Are there articles around detailing war stories about making the kind of move I am contemplating? I would like to read such before I get started. I have just purchased Maven: The Definitive Guide, and while the information there is very good, it tends to assume a start from scratch. I would like to keep the history in the Subversion respository if possible. I have done several conversions, and providing you rename and move the files in subversion, you can keep your history without issue. 2. Would I be better served by renaming directories at the start to Maven Convention over Configuration standards or by overrriding the defaults all the way down the line? Yes. This is the way I recommend myself. There are two ways you can do this... 1. Make the changes in trunk, and keep the existing build process functional while you change everything... this allows you to ignore maven until you get everything perfect. 2. Make the changes in a branch and merge them back when you're ready... I'd want to be on subversion 1.5.5 before trying that of course if you are using subversion 1.5.x and have repository access via http or https you will have a bit of fun when releasing using the release plugin. svn: does not have these issues. (A bug the mod_dav_svn prevents tagging from a working copy that is not based off of the head revision) 3. Would I be better off building a local network repository containing both the open source and proprietary code needed or would it be better to create a local repository only for the proprietary stuff and get the open source stuff from a remote repository. You would be best served using nexus to host your artifacts and cache all the remote ones. There are alternatives, but Nexus is, IMHO, the easiest to set up and get running, and also has the lowest cost of switching to the others (i.e. all the data is on the disk) (Note I have no affiliation with either Nexus or Sonatype ) Thanks. Steve Cohen - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Build time resolution of properties files
Hi, I'm trying to build a WAR which includes a properties file at build time. This properties file will vary according to the environment that it is being built for. (dev, test, prod). This would ideally be added during something like the process-resources stage, so that I can point my eclipse project at various environments. I've tried adding profiles to the project which specify an additional resource area where the property file can be pulled from. ie (src/main/properties/dev and src/main/properties/test). This works fine the first time I build my war and the correct properties file for the profile is included. However when I try to do it again with a different profile, the properties file is not replaced. Instead the properties file (from the previous build) is incorporated into the build. The only way to get it to work properly every time is to run mvn clean every time. At the moment, I've figured out another way where I use the ant runner to copy the desired properties file into src/main/resources. Is there a better way for me to do this. ps: The properties files all have the same name, but thats necessary as the application picking them up has this name hard-coded into its config. Thanks, Ian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]