On Thu, Mar 8, 2012 at 11:29 AM, Ron Wheeler <[email protected] > wrote:
> A Maven parent does not contain any code but manages default setting for > a project (versions of dependencies and deployment specifications) but I > think that I understand what you might mean. > > I am using that word "parent" incorrectly in the context of maven. It isn't a maven "parent' per se, but rather just a maven project that is only deployed via other maven projects that depend on it. Since this code is reused in several places, I thought it made sense to make a generic jar project that the other projects can pull from. > It looks like you should have one or more code projects that produce jars > that are dependencies for other projects. This is pretty standard. > > You seem to have a project that creates a war file. It should depend on > the other project's artifacts in order to get their jar files into the > right place in the war file. > This is pretty standard and maven knows how to built war files. > The war projects that depend on this code is able to bring in the jar no problem and it works well. > > The project that produces a jar sounds like it is trying to produce a > standalone executable. If its dependencies are set to point to the > libraries that it needs, you should get an executable jar all set up and > ready to be run. Maven knows how to do this. > You don't have to worry about classpaths or any of that stuff. > > Well I am taking a generic non-executable jar that has no classpath or main class referenced in the manifest and trying to convert it into an executable code that also references its dependencies in the manifest's classpath. There are several variations of this result so that is why the original jar and its manifest is so generic . > What I can see from your description is a pretty standard set of projects > that should not require any special set up or plug-ins. > It looks like a few jar POMs to make your libraries from your code, a war > POM to make the WAR using the WAR plug-in and another jar POM to make the > executable. > > Google for "maven executable jar" gives lots of listings including this > gem. > > > http://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html > > The shade plugin adds the main class to the manifest perfectly, but I don't see how I can add the classpath reference? > Why do you need to play with the manifest? > Are you building something so unusual that Maven has not been used to do > this before? > > Ron > > Unfortunately, as a maven newbie, all this is new. Thanks for the reply Ron! > > > > On 08/03/2012 1:25 PM, Ryan Wexler wrote: > > Essentially I have a source code module and dependencies in a parent > project as a jar. There are several projects which depend on it. For > instance it is used in a war project. > Another project that depends on it needs to produce am executable jar from > the same code and the manifest needs to reference all the dependencies in > the classpath with the prefix 'lib'. > On Mar 8, 2012 9:21 AM, "Ron Wheeler" <[email protected]> > wrote: > >> Sound interesting but what are you trying to make in the end? >> >> What is the 30,000 ft view of the problem? >> >> Ron >> >> On 08/03/2012 12:03 PM, Ryan Wexler wrote: >> >>> On Thu, Mar 8, 2012 at 8:36 AM, Wayne Fay<[email protected]> wrote: >>> >>> I would also like to add the classpath and set a classpathprefix like >>>>> you >>>>> can do using the normal maven jar. >>>>> <addClasspath>true</addClasspath> >>>>> <classpathPrefix>lib/</classpathPrefix> >>>>> >>>>> Is there a way to do this with the shade plugin? >>>>> >>>> Generally, the thinking with Shade is that you are building an >>>> "uber-jar" that is going to contain the contents all your dependency >>>> jars along with your own code, so there should be no need to specify a >>>> classpath since it is all in one single jar file. >>>> >>>> What is your requirement? >>>> >>>> >>>> I am essentially creating a jar from a jar. I was not intent on >>> embedding >>> my dependencies, so maybe this is the wrong tool. >>> >>> I was more interested as to the extent to which you can customize a jar >>> using the ManifestResourceTransformer. My initial thought is that it >>> could >>> inherit all of a jar artificat's dependencies and then affect that jar >>> just >>> like you were using the jar plugin. But my thought process maybe wrong >>> here. >>> >>> Maybe what I want instead is to unpack a jar artifact and it's >>> dependencies >>> and then recreate the jar from scratch. Not sure how you unpack it's >>> dependencies though. >>> >>> Wayne >>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>>> >> >> -- >> Ron Wheeler >> President >> Artifact Software Inc >> email: [email protected] >> skype: ronaldmwheeler >> phone: 866-970-2435, ext 102 >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > -- > Ron Wheeler > President > Artifact Software Inc > email: [email protected] > skype: ronaldmwheeler > phone: 866-970-2435, ext 102 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
