Alfresco 3.2c 有一个跟踪图像,它使用我需要为项目删除的 Javascript 注入到页脚中。javascript 实际上是alfresco-share-src.zip
在类中的 SDK 中硬编码的org/alfresco/web/scripts/MessagesWebScript.java
。
我们目前正在使用 Maven 项目构建 Alfresco,它从 maven 插件和存储库中提取了大部分 Alfresco 和 Share,为我们提供了干净的根构建添加。然而,由于这个类是硬编码的,我们不想触及原始的jars/zips,我想我可以将文件的新副本添加到share/src/main/java/org/alfresco/web/scripts/MessagesWebScript.java
,将其编译到 war 文件的 WEB-INF 中,从而覆盖将从 jar 加载的内容(是的,我知道这样做的坏方法)。
但是,如果我只是添加文件,则会出现/share/src/main/java/org/alfresco/web/scripts/MessagesWebScript.java:[48,80] error: cannot find symbol
错误
public class MessagesWebScript extends org.springframework.extensions.webscripts.MessagesWebScript
这让我相信它没有引入用于构建 war 文件的相同依赖项(即 spring-surf-parent 依赖项)。如果我尝试将该依赖项添加到 share.pom 文件(如下所示),maven 会成功构建,但依赖项会以某种方式拉入 servlet API jar 文件,将它们添加到战争中,然后我得到预期的The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
错误。
<dependency>
<groupId>org.springframework.extensions.surf</groupId>
<artifactId>spring-surf-parent</artifactId>
<version>1.2.0-M3</version>
</dependency>
我的 share.pom 如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>share</artifactId>
<name>Alfresco Share Client</name>
<packaging>war</packaging>
<description>Alfresco Share Client</description>
<parent>
<groupId>nz.net.mycompany</groupId>
<artifactId>custom-alfresco</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version><!--$NO-MVN-MAN-VER$-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.2</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>jetty</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${basedir}/src/scripts/less2css.sh</executable>
<arguments>
<argument>${basedir}</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<!-- Integration Tests should not be run here -->
<exclude>**/IT*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.14.1</version>
<executions>
<execution>
<goals>
<!-- <goal>integration-test</goal> -->
<!-- <goal>verify</goal> -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.2</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<webDriverCapabilities>
<phantomjs.binary.path>${project.basedir}/src/test/bin/phantomjs</phantomjs.binary.path>
</webDriverCapabilities>
<preloadSources>
<source>${project.basedir}/src/test/javascript/fixtures/fixture_messages.js</source>
</preloadSources>
<jsSrcDir>${project.basedir}/target/share/js/</jsSrcDir>
<jsTestSrcDir>${project.basedir}/src/test/javascript/</jsTestSrcDir>
<sourceIncludes>
<!-- add the ones we want first -->
<include>**/yui-common.js</include>
<include>**/alfresco.js</include>
<!-- Then the default -->
<include>**/*.js</include>
</sourceIncludes>
<haltOnFailure>false</haltOnFailure>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies
| NOTE: At least one WAR dependency must be uncompressed first
| NOTE: In order to have a dependency effectively added to the WAR you need to
| explicitly mention it in the overlay section.
| NOTE: First-win resource strategy is used by the WAR plugin
-->
<overlays>
<!-- The current project customizations -->
<overlay />
<!-- The Share WAR -->
<overlay>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share</artifactId>
<type>war</type>
<!-- To allow inclusion of META-INF -->
<excludes />
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
</project>