Re: Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml
you could add the whole tomcat.zip to nexus, unpack it before compile and install-file to local repository. I had a similar problem, I needed to have the jars of an resource adapter rar on the classpath: > I was thinking of adapting maven-warpath-plugin, but in the end I built an > uber jar in a sub module with maven-ant-run (unzip, zip and zipgroupfileset) > and did an install-file to local repository. Am Fr., 16. Okt. 2020 um 10:25 Uhr schrieb /dev /local/ca : > > What is the simplest way to specify a directory (and all jars underneath > this directory) to be in the maven classpath when it compiles .java classes > and builds a .jar? > > The directory is not in my git repo or any directory under my IDE project > files. > > I have a requirement to create a pom.xml that will reference the current > project, and external jars in a /lib/ directory. > -- > > The requirement is to put together a pom.xml for a maven build that depends > on jars in: > > $TOMCAT_HOME/webapps//WEB-INF/lib/ > > I want to reference that location directly in the maven pom.xml file and > not copy the /lib/*.jar files to another directory under my git repo. > > The .../WEB-INF/lib/ contains .jar files that contains classes that my > project imports. > > The jar that is then built will be put into: > $TOMCAT_HOME/webapps//WEB-INF/lib/ to extend the product as > per the vendor instructions. > -- > > If anyone has had this exact issue, and has a reference pom.xml that can be > pasted here, it would be extremely helpful and get me going quickly. > -- > > Irrespective of the deployment part where I copy the jar to > /webapps//WEB-INF/lib/, I would be happy to just get files > under /src/com/.../.java/ compiled and put into a jar in the /target/ > directory - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml
I appreciate that you're trying to use Maven to build software, but you've framed your question unfairly. What is the simplest way to specify a directory (and all jars underneath > this directory) to be in the maven classpath when it compiles .java classes > and builds a .jar? > Maven builds from versioned JARs identified by coordinates. You cannot jam a directory of JARs into the classpath. Maybe you can do that in Ant, but not Maven. I need something with no more than 5..10 lines of XML that would include > this directory so that it would pick up all jars and add to the class path. > Doesn't exist, no matter how much you want it. There are hundreds of jar files in the > $TOMCAT_HOME//WEB-INF/lib directory. > Over time I can create an entry for each one, but I just don't have time > for that right now, also I would need to determine the version of each and that would be a nightmare. The time is now. Don't leave the nightmare for someone else later. I suspect your real issue is closer to this: https://blog.sonatype.com/2009/04/how-to-convert-from-ant-to-maven-in-5-minutes/ Greg Chabala On Fri, Oct 16, 2020 at 9:48 AM /dev /local/ca wrote: > Thank you for the suggestion Bernd, > > Do you have an example you can share? There are hundreds of jar files in > the $TOMCAT_HOME//WEB-INF/lib directory. > > I need something with no more than 5..10 lines of XML that would include > this directory so that it would pick up all jars and add to the class path. > Over time I can create an entry for each one, but I just don't have time > for that right now, also I would need to determine the version of each and > that would be a nightmare. > > If you can please help with what the question asks. > > On Fri, Oct 16, 2020 at 2:38 AM Bernd Eckenfels > wrote: > > > Hello, > > > > It is really not a good idea to fight maven. If you need something in the > > classpath for compile, specify it as dependency in the Pom. Otherwise > your > > build cannot be repeated and the project is hard to set up. > > > > All tomcat libraries needed to compile should be in the maven repository. > > If you have custom artifacts, the normal method is to upload them to a > > (own) repository Server and reference them there. > > > > There is a way to specify a local („system“) location for dependencies, > > but I would not recommend that way. (And in all cases not possible to > use a > > wildcard/directory search) > > > > Gruss > > Bernd > > > > > > -- > > http://bernd.eckenfels.net > > > > Von: /dev /local/ca > > Gesendet: Friday, October 16, 2020 10:24:50 AM > > An: users@maven.apache.org > > Betreff: Using Apache Maven, what is the simplest way to include > > /lib/ directory in the classpath in the > > pom.xml > > > > What is the simplest way to specify a directory (and all jars underneath > > this directory) to be in the maven classpath when it compiles .java > classes > > and builds a .jar? > > > > The directory is not in my git repo or any directory under my IDE project > > files. > > > > I have a requirement to create a pom.xml that will reference the current > > project, and external jars in a /lib/ directory. > > -- > > > > The requirement is to put together a pom.xml for a maven build that > depends > > on jars in: > > > > $TOMCAT_HOME/webapps//WEB-INF/lib/ > > > > I want to reference that location directly in the maven pom.xml file and > > not copy the /lib/*.jar files to another directory under my git repo. > > > > The .../WEB-INF/lib/ contains .jar files that contains classes that my > > project imports. > > > > The jar that is then built will be put into: > > $TOMCAT_HOME/webapps//WEB-INF/lib/ to extend the product as > > per the vendor instructions. > > -- > > > > If anyone has had this exact issue, and has a reference pom.xml that can > be > > pasted here, it would be extremely helpful and get me going quickly. > > -- > > > > Irrespective of the deployment part where I copy the jar to > > /webapps//WEB-INF/lib/, I would be happy to just get files > > under /src/com/.../.java/ compiled and put into a jar in the /target/ > > directory > > >
Re: Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml
Thank you for the suggestion Bernd, Do you have an example you can share? There are hundreds of jar files in the $TOMCAT_HOME//WEB-INF/lib directory. I need something with no more than 5..10 lines of XML that would include this directory so that it would pick up all jars and add to the class path. Over time I can create an entry for each one, but I just don't have time for that right now, also I would need to determine the version of each and that would be a nightmare. If you can please help with what the question asks. On Fri, Oct 16, 2020 at 2:38 AM Bernd Eckenfels wrote: > Hello, > > It is really not a good idea to fight maven. If you need something in the > classpath for compile, specify it as dependency in the Pom. Otherwise your > build cannot be repeated and the project is hard to set up. > > All tomcat libraries needed to compile should be in the maven repository. > If you have custom artifacts, the normal method is to upload them to a > (own) repository Server and reference them there. > > There is a way to specify a local („system“) location for dependencies, > but I would not recommend that way. (And in all cases not possible to use a > wildcard/directory search) > > Gruss > Bernd > > > -- > http://bernd.eckenfels.net > > Von: /dev /local/ca > Gesendet: Friday, October 16, 2020 10:24:50 AM > An: users@maven.apache.org > Betreff: Using Apache Maven, what is the simplest way to include > /lib/ directory in the classpath in the > pom.xml > > What is the simplest way to specify a directory (and all jars underneath > this directory) to be in the maven classpath when it compiles .java classes > and builds a .jar? > > The directory is not in my git repo or any directory under my IDE project > files. > > I have a requirement to create a pom.xml that will reference the current > project, and external jars in a /lib/ directory. > -- > > The requirement is to put together a pom.xml for a maven build that depends > on jars in: > > $TOMCAT_HOME/webapps//WEB-INF/lib/ > > I want to reference that location directly in the maven pom.xml file and > not copy the /lib/*.jar files to another directory under my git repo. > > The .../WEB-INF/lib/ contains .jar files that contains classes that my > project imports. > > The jar that is then built will be put into: > $TOMCAT_HOME/webapps//WEB-INF/lib/ to extend the product as > per the vendor instructions. > -- > > If anyone has had this exact issue, and has a reference pom.xml that can be > pasted here, it would be extremely helpful and get me going quickly. > -- > > Irrespective of the deployment part where I copy the jar to > /webapps//WEB-INF/lib/, I would be happy to just get files > under /src/com/.../.java/ compiled and put into a jar in the /target/ > directory >
Re: Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml
Hello, It is really not a good idea to fight maven. If you need something in the classpath for compile, specify it as dependency in the Pom. Otherwise your build cannot be repeated and the project is hard to set up. All tomcat libraries needed to compile should be in the maven repository. If you have custom artifacts, the normal method is to upload them to a (own) repository Server and reference them there. There is a way to specify a local („system“) location for dependencies, but I would not recommend that way. (And in all cases not possible to use a wildcard/directory search) Gruss Bernd -- http://bernd.eckenfels.net Von: /dev /local/ca Gesendet: Friday, October 16, 2020 10:24:50 AM An: users@maven.apache.org Betreff: Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml What is the simplest way to specify a directory (and all jars underneath this directory) to be in the maven classpath when it compiles .java classes and builds a .jar? The directory is not in my git repo or any directory under my IDE project files. I have a requirement to create a pom.xml that will reference the current project, and external jars in a /lib/ directory. -- The requirement is to put together a pom.xml for a maven build that depends on jars in: $TOMCAT_HOME/webapps//WEB-INF/lib/ I want to reference that location directly in the maven pom.xml file and not copy the /lib/*.jar files to another directory under my git repo. The .../WEB-INF/lib/ contains .jar files that contains classes that my project imports. The jar that is then built will be put into: $TOMCAT_HOME/webapps//WEB-INF/lib/ to extend the product as per the vendor instructions. -- If anyone has had this exact issue, and has a reference pom.xml that can be pasted here, it would be extremely helpful and get me going quickly. -- Irrespective of the deployment part where I copy the jar to /webapps//WEB-INF/lib/, I would be happy to just get files under /src/com/.../.java/ compiled and put into a jar in the /target/ directory
Using Apache Maven, what is the simplest way to include /lib/ directory in the classpath in the pom.xml
What is the simplest way to specify a directory (and all jars underneath this directory) to be in the maven classpath when it compiles .java classes and builds a .jar? The directory is not in my git repo or any directory under my IDE project files. I have a requirement to create a pom.xml that will reference the current project, and external jars in a /lib/ directory. -- The requirement is to put together a pom.xml for a maven build that depends on jars in: $TOMCAT_HOME/webapps//WEB-INF/lib/ I want to reference that location directly in the maven pom.xml file and not copy the /lib/*.jar files to another directory under my git repo. The .../WEB-INF/lib/ contains .jar files that contains classes that my project imports. The jar that is then built will be put into: $TOMCAT_HOME/webapps//WEB-INF/lib/ to extend the product as per the vendor instructions. -- If anyone has had this exact issue, and has a reference pom.xml that can be pasted here, it would be extremely helpful and get me going quickly. -- Irrespective of the deployment part where I copy the jar to /webapps//WEB-INF/lib/, I would be happy to just get files under /src/com/.../.java/ compiled and put into a jar in the /target/ directory