Unable to locate Spring framework's 4.0.6 jar files? - java

I'm completely new in Spring and followed this tutorial http://tutorialspoint.com/spring
and this video too http://www.youtube.com/watch?v=ZwMwfGNrRtE
And according to this i downloaded spring-framework-4.0.6.RELEASE-dist.zip from here
I did extracted those zip files,
Now i'm unable to locate jars files into folder, But www.tutorialspoint.com/spring says It contains this pic.
But into my folder(which i downloaded spring framework), I can't locate these library please help!!
I did search all jar files in that folder but i could find only this pic
and not being able to find these jar files:
antlr-runtime-3.0.1
org.springframework.aop-3.1.0.M2
org.springframework.asm-3.1.0.M2
org.springframework.aspects-3.1.0.M2
org.springframework.beans-3.1.0.M2
org.springframework.context.support-3.1.0.M2
org.springframework.context-3.1.0.M2
org.springframework.core-3.1.0.M2
org.springframework.expression-3.1.0.M2
commons-logging-1.1.1

Well surprisingly, the dist for release 4.0.6 does not contain the jars for 3.1.0.M2 ! More seriously, under lib dir on related zip file, you will find all the jars for spring 4.0.6.
But you must have a minimal knowledge on your build environment be it maven, eclipse, Netbeans + ant, Netbeans + maven, ...
And do not forget the documentation for spring that explains what external jars are required for some operations. Notably commons-logging-1.1.1 even if the manual explains how to use other loggin utilities.

You may want to consider using Maven, as opposed to manually downloading jar files and referring to them explicitly.
With Maven, you'd declare a dependency on the spring framework (including specific version) and you'd have all of the dependencies downloaded to a local repository, including transitory dependencies (you'd only need to specify the framework itself, for example, although in your case you'd probably need to include security and/or mvc.)

Related

java - how to get the jar files of a library or framework

I want to download the .jar file of a java framework.
That .jar should of course contain all the .class files that I need for my project.
I tried downloading from here:
https://mvnrepository.com/artifact/org.apache.camel/camel-core/3.18.2
But the .jar file is only 4KB big and contains only meta information, but no java classes.
I found jar files with java classes in them in older versions, but in newer versions they seem to upload only meta information.
So I don't know how to get to the .jar file with all .class files inside.
I don't want to work with maven or gradle for now.
And you can't just download jars with maven or gradle you have to build your entire project with it.
I also searched the github (https://github.com/apache/camel) and source code of the "Apache Camel" project and did not encounter jar files.
Is there any other popular place where open source java frameworks/libraries with jar files can be found?
The apache camel module doesn't contain any code. It just declares a list of dependencies, in the /META-INF/maven/org.apache.camel/camel-core/pom.xml file:
camel-core-engine
camel-core-languages
camel-bean
camel-browse
camel-cluster
camel-controlbus
camel-dataformat
camel-dataset
camel-direct
camel-directvm
camel-file
camel-health
camel-language
camel-log
camel-mock
camel-ref
camel-rest
camel-saga
camel-scheduler
camel-seda
camel-stub
camel-timer
camel-validator
camel-vm
camel-xpath
camel-xslt
camel-xml-jaxb
camel-xml-jaxp
slf4j-api
You have to download the jars that you need in this list of dependencies. All jars can be found on https://mvnrepository.com/.
This is why everyone will recommend you to use maven or gradle, as those tools will manage the dependencies for you.

Make an executable JAR from a maven project

I have a question about using Apache Maven: I built a very simple Maven-based project. This works fine so far.
Now I want to make an executable JAR file from my target file. The problem here seems to be that the dependencies (external libraries) are not packaged together with my app.
I've already googled and found the maven-assembly-plugin. That actually does exactly what I want, but seems to be somewhat inflexible, since the dependencies are not automatically resolved and I can not specify file filters, etc. (or only with much effort over assembly.xml).
What I really like is the solution of spring-boot-maven-plugin, so automatically determine all linked JAR files and put in a lib folder. Now my little project is not a Spring application, so Spring Boot might not be suitable for me, right?
So what would interest me: Is there a way to get a similarly structured and executable JAR archive as spring-boot-maven-plugin builds?
Just use Maven Shade Plugin. It packages your dependencies inside your jar and you can specify the Java packages to exclude

Java WAR deployment issue

I've built a basic Java Web Project using Netbeaans, which uses Maven.
The issue is, in my 'dependencies' I see 'javaee-web-api-6.0.jar'. However, when I build the project, in the .war file I don't see this .jar file included anywhere.
Am I missing something, or is there any extra step that I need to take to have all the dependencies be included in the .jar?
Servlet API dependencies should never be in the resulting war file. It is a dependency that is provided by your container. Having it in the war file would only result in a bunch of classloader issues. Most containers would ignore the jar file anyway, if it was present inside the war.
Check the scope of javaee-web-api-6.0.jar dependency. If its provided then it will not be bundled into the resultant war.
javaee-api-6.0.jar and servlet-api-3.jar These jars are already provided by Tomcat(assuming using tomact). To verify this look in <TOMCAT_HOME>\lib to see that these jars are already there.

Add resource files to classpath using daemon(jsvc)

I am struggeling with this for a while.
I am using Spring3.1 in a standalone env. I have resources files which I need to add into the classpath (applicationXML). In eclipse it's a known and easy way. Now I am trying to deploy my application to a standalone env on linux using Daemon (commons-daemon-1.0.3.jar).
How can I add resources files there to the classpath?
One thing you can do is use the Maven Shade plugin. This is used to create a SuperJAR of everything in your build profile — dependent JARs from Apache and Spring, as well as your own code. The Shade Plugin can that add a Classpath entry of "." into the Manifest of the SuperJAR, this is precisely how you will be able to run the Main class of the SuperJAR, but have the classloader look in both a local directory as well as a JAR for all your components.
You'll have to adjust your build a bit so that things like log4j.properties and application-context.xml, and other files you wish to have sysadmins/customers modifer after build are kept out of the resources/path — otherwise they will get baked into the build.
You might look at my source code here http://sourceforge.net/projects/jee2pctest/. The client driver code provides an excellent example of how to use the Maven Shade plugin to create a directly executable JAR with external properties files.The magic is mainly in the pom.xml file. One Caveat, I am using the Maven build tooling, if you are still on ANT using using your IDE's built-in packager, then you might have some work cut out.

Maven: How to "best" use maven also for downloding "project related files" like configuration .xmls?

I am new to maven and ran into the following question/problem:
Given Hibernate as example: When I use maven, I can easily mange dependencies by including Hibernate as a dependency. The jars are manged perfectly. But Hinbernate consits of quite a lot of other (config) files that are required to get it running (like hibernate.cfg.xml).
1.) Does Maven provide any solution to also download these files (so I can use them as a basis for my additions. It would not make sense writing these complexe xmls newly from the scratch). => For Example is there "goal/target" in maven that spits out these required "relataed config" files into a specifc directory?
2.) How do you handle this case? Although I use mave, does this meand that I neverless have to download the common zip/gz Project-Files that used to contain these files? (As i did it in the past)=>So maven only manages/solves a part of the "problems" that I have in this regard.
Update: The files I am talking about are normally files I need to edit quite often (configuration files). So they are mostly not provided as a static config file inside the jars.
UPDATE 2 => Real live example: I just started to write a POM for my project and googled the dependency-names, like "hibernate-core", "hibernate-validation", "rome" (RSS Lib), "tuckey" (Rewrite Filter) and included them in my POM. Now I have all the jars downloaded via maven (great!), but however I do not have any (sample/base) config files. The Web-app can not be run...
Formerly (when I did not use maven) I downloaded the official distribution zip/gz package and they contained everything: jars and sample config files. Ok its great that maven helps me with the jars, but in the end I do have to navigate to every project webpage and also download the zip/gz distribuation package (as I did before) to only get the sample config files to include them in my project and then make some smaller changes... (without hibernate.cfg.xml hibernate does not start and writing it from scratch is an absolute nightmare, the best solution is take their sample file and update some specific stuff...
Thank you very much for any advice.
Markus
Most people handle this by including files like this inside their jars and referencing them via classpath.
If this doesn't appeal to you, and you have a bunch of them, the Maven solution is (a) use the assembly plugin to combine them into a jar or zip or tar; and attach the resulting item as an artifact with a non-empty classifier, and (b) use the maven-dependency-plugin to download the artifact and unpack it under target/something.

Categories

Resources