使用Maven插件安装Liferay portlet

时间:2014-09-05 11:00:02

标签: eclipse maven liferay

我使用maven插件创建了一个新的Liferay插件项目,当我执行mvn install(直接从Eclipse通过m2e插件)时,我收到以下错误:

Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.1.1:build-css (default) on project sample-portlet: basedir C:\eclipseLiferay\workspace\sample-portlet\target\sample-portlet-1.0.0-SNAPSHOT does not exist

现在,如果我手动创建该目录,那么它可以正常工作,但该插件不应该自己创建它(就像其他非Liferay maven项目一样)?

3 个答案:

答案 0 :(得分:0)

我们上一个项目遇到了同样的问题。在我们的例子中,我们不需要合并CSS,所以我们已经配置maven跳过这个阶段:

<build>
    <plugins>
        <plugin>
            <groupId>com.liferay.maven.plugins</groupId>
            <artifactId>liferay-maven-plugin</artifactId>
            <version>${liferay.maven.plugin.version}</version>
            <executions>
                <!-- Commented! Is not necessary
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>build-css</goal>
                    </goals>
                </execution> -->
            </executions>
            <configuration>
                <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
                <appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
                <liferayVersion>${liferay.version}</liferayVersion>
                <pluginType>portlet</pluginType>
                [...]
            </configuration>
        </plugin>
        [...]
    </plugins>
</build>

在所有项目中(几个月),我找不到任何禁用此阶段的问题。

希望它有所帮助!

答案 1 :(得分:0)

此错误仅发生在6.1.1及更低版本中。除非你升级liferay版本,否则我认为没有优雅的解决方案

答案 2 :(得分:0)

检查以下文件.settings / org.eclipse.wst.common.component

    <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="ProjectName">
        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
        <wb-resource deploy-path="/" source-path="/target/m2e-liferay/resources"/>
        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="java-output-path" value="/ProjectName/target/classes"/>
        <property name="context-root" value="ProjectName"/>
    </wb-module>
</project-modules>