If I understand correctly, you want to override a single Java class, which in this case, happens to implement a web script, but your solution of repackaging the share WAR with a forked copy of this class is not working.
Re-defining core Alfresco (or Share in this case) classes is a bad idea. This web script is declared in the Spring config file alfresco/slingshot-application-context.xml
in the webapp classpath, and therefore what you should be doing is overriding it in your own *-context.xml
file under alfresco/web-extension
, e.g.
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- I18N resources and messages Web Script -->
<bean id="webscript.org.springframework.extensions.messages.get"
parent="webscript"
class="my.custom.namespace.MessagesWebScript">
<property name="webFrameworkConfigElement" ref="webframework.config.element"/>
<property name="dependencyHandler" ref="dependency.handler"/>
</bean>
</beans>
There is no reason why you should not implement the override through Spring from the start. Spring beans are designed for this purpose and it adds very little to the effort while giving you the ability to more effectively debug if it does not work as you expect.
Obviously you will also need to make sure that your custom class my.custom.namespace.MessagesWebScript
compiles as part of your build, and it sounds like it is not doing so at present. This is probably because you are missing some JAR (not WAR) dependencies in your POM - take a look at the Google Docs integration Share POM for the set which we use.
Lastly I would suggest that your package your customisation as an AMP file. The Alfresco Maven SDK provides full support for this and you just need to declare it as a parent - see the Google Docs parent POM for an example.