We've recently upgraded one of our projects. This involves new versions of JARs also.
Sitemesh was one of them. We updated from 2.2.1 to 2.4.2. Things stopped working.
We had a custom filter extend Sitemesh's PageFilter which now does not work because in v2.4 PageFilter extends SiteMeshFilter which does not expose the same methods (the ones we were overriding).
OK, no biggy, we'll just change our code to match, but then I saw this in the source code I downloaded from http://java.net/downloads/sitemesh/
/**
* Core Filter for integrating SiteMesh into a Java web application.
*
* #author Joe Walnes
* #author Scott Farquhar
* #since SiteMesh 3
*/
public class SiteMeshFilter implements Filter {
private FilterConfig filterConfig;
private ContainerTweaks containerTweaks;
private static final String ALREADY_APPLIED_KEY = "com.opensymphony.sitemesh.APPLIED_ONCE";
............
#since SiteMesh 3? This is v2.4.2. What 3?
Is the release corrupt or what? Am I missing something?
I'm using sitemesh 2.4.2 in one project and it works fine.
You can see that that change (which mentions Sitemesh 3) was done back in 2005 when they refactored the architecture to be compatible with sitemesh3. Here's the commit in github.
I remember getting a similar impression when I was browsing the javadocs a few months ago :).
So the answer is: The jar is not corrupt, it's just the result of a crooked merge.
Related
In the project I work with Hibernate ORM version 4.2.6.Final previously was used. Now I'm trying to update it to the latest release, which is 4.3.10.Final. However, org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl is no longer mentioned in the docs and no longer supplied.
This is how this class is used in the code I work with:
( (DatasourceConnectionProviderImpl) (
(SessionFactoryImpl) getDAO().getSessionFactory() )
.getConnectionProvider() )
.setDataSource(ds);
What can it be replaced with? And where can I find the mention of its removal in the Hibernate docs or release notes?
Finally, by using GrepCode.com multi-repository search engine I figured out that DatasourceConnectionProviderImpl class was not actually removed. Instead, since Hibernate 4.3.0, some classes are moved:
from org.hibernate.service.jdbc.connections.internal
to org.hibernate.engine.jdbc.connections.internal.
So import statement has to be changed to
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
still learning to master akka java with play framework. I have a code snippet below. It was working fine but has decided to give some headaches.
public class Application extends Controller {
static ActorRef masterActor;
RubineActor rubineactor;
public static Result index() {
return ok(index.render(null));
........ somecode
}
it was working fine but now my eclipse juno complains that it cannot resolve the index object in the return line . I am new to both akka and play framework . Can someone please explain what is happening to me. cos have to submit the project as my final year project. thanks
Your problem is not related to Akka, it's a template concern.
The variable index is provided by a template import, certainly import views.html.*;
Eclipse sometimes cannot resolve this object because it is generated automatically by Play after the first request.
Templates are compiled as standard Scala functions, following a simple naming convention. If you create a views/Application/index.scala.html template file, it will generate a views.html.Application.index class that has a render() method.
See the hello word sample for a concrete exemple.
I am writing a plugin to Maven. I want to customize action depend on Maven version (person's who use my plugin)
something like:
if (MavenVer == "2.2.1")
//do some things
if (MavenVer == "3.0")
//do another things
I found out build-helper-maven-plugin but i'm not shure how to use it to do this job.
you need to inject maven reference into plugina and simply check version using API
http://maven.apache.org/ref/2.2.1/maven-project/apidocs/org/apache/maven/project/MavenProject.html#getVersion()
http://maven.apache.org/ref/3.0.3/maven-core/apidocs/org/apache/maven/project/MavenProject.html#getVersion()
code for injection
public class MyMojo extends AbstractMojo {
/**
* #component
*/
ArtifactFactory factory;
/**
* #component
*/
ArtifactResolver artifactResolver;
/**
* #parameter default-value="${project.remoteArtifactRepositories}"
*/
List remoteRepositories;
/**
* #parameter default-value="${localRepository}"
*/
ArtifactRepository localRepository;
/**
* #parameter default-value="${project}"
*/
MavenProject mavenProject;
I have been looking for an answer to your question and I have come to the conclusion that there is no simple way to get the maven version, or at least I couldn't find it. The best I was able to find is that the maven-enforcer-plugin contains code that looks up the maven version. However in looking at the maven-enforcer-plugin source code it is a little complicated and involves getting a handle to a RuntimeInformation instance through plexus (the IoC container used by Maven).
I recommend you take a look at the maven-enforcer-plugin and see if you can use what they did. Pay particular attention to RequireMavenVersion and EnforcerMojo classes.
I'm trying to write a custom maven plugin, and want to get some information about the project.
After some searching around, I found that I can set parameters to certain project related values (presumably from the POM?) - e.g.
/**
* #goal myPlugin
*/
public class MyTestMojo extends AbstractMojo {
/**
* #parameter expression="${project}"
* #required
* #read-only
*/
private Object project;
#Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info(project.toString());
}
}
However, I cannot find any documentation on what parameters are available in this format. At the moment, I'm proceeding with trial and error, but that's proving a bit frustrating.
Any ideas?
Here is a short list of available properties. You may also want to look trough available Maven plugin tutorials.
See the Mojo API specification, section The Descriptor and Annotations.
There is a good introduction to writing plugins in Maven: The Complete Reference: 11.4 Writing a Custom Plugin, section 11.4.5. Mojo Class Annotations on the Sonatype website.
Reading the Tomcat 7 source code, I just wonder why Tomcat instance Catalina and invokes the related methods by using reflection instead of simply using new to create the object and calling the method directly?
The answer is in the javadoc comment of the Bootstrap class:
/**
* Bootstrap loader for Catalina. This application constructs a class loader
* for use in loading the Catalina internal classes (by accumulating all of the
* JAR files found in the "server" directory under "catalina.home"), and
* starts the regular execution of the container. The purpose of this
* roundabout approach is to keep the Catalina internal classes (and any
* other classes they depend on, such as an XML parser) out of the system
* class path and therefore not visible to application level classes.
*
* #author Craig R. McClanahan
* #author Remy Maucherat
* #version $Id: Bootstrap.java 1142323 2011-07-02 21:57:12Z markt $
*/
public final class Bootstrap { ... }