2012-10-16 77 views
1

我想創建liferay主題,所以我從原型創建了一個Maven項目。我的pom.xml:Liferay主題+ maven

<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> 
    <groupId>com.liferay.sample</groupId> 
    <artifactId>sample-theme</artifactId> 
    <packaging>war</packaging> 
    <name>sample-theme Theme</name> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>com.liferay.maven.plugins</groupId> 
     <artifactId>liferay-maven-plugin</artifactId> 
     <version>6.1.20</version> 
     <executions> 
      <execution> 
      <phase>generate-sources</phase> 
      <goals> 
       <goal>theme-merge</goal> 
       <goal>build-css</goal> 
       <goal>build-thumbnail</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir> 
      <appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir> 
      <appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir> 
      <appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir> 
      <liferayVersion>${liferay.version}</liferayVersion> 
      <parentTheme>${liferay.theme.parent}</parentTheme> 
      <pluginType>theme</pluginType> 
      <themeType>${liferay.theme.type}</themeType> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.5</version> 
     <configuration> 
      <encoding>UTF-8</encoding> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <dependencies> 
    <dependency> 
     <groupId>com.liferay.portal</groupId> 
     <artifactId>portal-service</artifactId> 
     <version>6.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.liferay.portal</groupId> 
     <artifactId>util-bridges</artifactId> 
     <version>6.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.liferay.portal</groupId> 
     <artifactId>util-taglib</artifactId> 
     <version>6.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.liferay.portal</groupId> 
     <artifactId>util-java</artifactId> 
     <version>6.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.portlet</groupId> 
     <artifactId>portlet-api</artifactId> 
     <version>2.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.4</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet.jsp</groupId> 
     <artifactId>jsp-api</artifactId> 
     <version>2.0</version> 
     <scope>provided</scope> 
    </dependency> 
    </dependencies> 
    <properties> 
    <liferay.theme.parent>_styled</liferay.theme.parent> 
    <liferay.theme.type>vm</liferay.theme.type> 
    </properties> 
</project>And I use maven:package and I see an error: 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building sample-theme Theme 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.400s 
[INFO] Finished at: Tue Oct 16 14:47:58 CEST 2012 
[INFO] Final Memory: 2M/15M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Could not find goal 'build-css' in plugin com.liferay.maven.plugins:liferay-maven-plugin:6.1.0 among available goals build-lang, build-wsdd, build-ext, build-service, direct-deploy, theme-merge, build-thumbnail, deploy -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException 

有什麼不對?我嘗試更改版本liferay-maven-plugin,但它不能解決我的問題。

+0

集結CSS是不是一個這個插件支持的目標中列出的目標(來自你的maven錯誤)。你的輸出似乎認爲你使用的是插件版本6.1.0,但你的pom建議6.1.20 - 你列出的pom的輸出是什麼? – DaveRlz

+0

那麼,我應該如何改變我的pom.xml? – witek010

+0

我將pom中的插件版本更改爲6.1.0,並且仍然存在錯誤 – witek010

回答

0

您沒有一個名爲'build-css'的目標 您是否在使用groovy作爲您的配置文件? 你在這裏粘貼的只是一個構建文件,供Maven使用。 你在哪裏找到其他目標,例如,尋找「構建縮略圖」和「主題合併」?必須位於Maven構建文件正在讀取的配置文件中。 如果有其他目標,你需要在那裏創建你的目標,或者在類似的文件中。然後再次建立。

2

使用版本6.1.1,因爲在版本liferay-maven-plugin.jar6.1.0

看看liferay-maven-plugin.jar/META-INF/maven/plugin.xml可用的目標沒有build-css目標。

0

正如其他人寫的 - 6.1.0不支持「集結CSS」的目標,所以你應該刪除或註釋掉以下在你的pom.xml行:

<goal>build-css</goal>