所以,我的目标是学习在框架开发中使用React创建Liferay portlet。我已经使用了instructions并使用maven来构建我的项目
mvn archetype:generate \
-DarchetypeGroupId=com.liferay \
-DarchetypeArtifactId=com.liferay.project.templates.npm.react.portlet \
-DgroupId=com.liferay \
-DartifactId=my-npm-react-portlet \
-Dpackage=com.liferay.npm.react \
-Dversion=1.0 \
-DclassName=MyNpmReactPortlet \
-DpackageJsonVersion=1.0.0
当我部署我刚制作的portlet时,Proplem现在出现了。除了处理my-npm-react-portlet-1.0.jar
之外,服务器不会向控制台打印任何其他内容我已经使用Blade sh lb和blade sh diag检查了我的模块,结果是:
Unresolved requirement: Import-Package: com.liferay.frontend.js.loader.modules.extender.npm; version="[1.0.0,2.0.0)"
Project bnd.bnd
Bundle-Name: my-npm-react-portlet <br/>
Bundle-SymbolicName: com.liferay.npm.react <br/>
Bundle-Version: 1.0 <br>
Export-Package: com.liferay.npm.react.constants <br/>
Web-ContextPath: /my-npm-react-portlet <br/>
-jsp: *.jsp,*.jspf <br/>
-plugin.jsp: com.liferay.ant.bnd.jsp.JspAnalyzerPlugin <br/>
-plugin.npm: com.liferay.ant.bnd.npm.NpmAnalyzerPlugin <br/>
-plugin.resourcebundle: <br/>com.liferay.ant.bnd.resource.bundle.ResourceBundleLoaderAnalyzerPlugin <br/>
-plugin.sass: com.liferay.ant.bnd.sass.SassAnalyzerPlugin <br/>
-sass: *
Bundle-Name: my-npm-react-portlet
Bundle-SymbolicName: com.liferay.npm.react
Bundle-Version: 1.0
Export-Package: com.liferay.npm.react.constants
Web-ContextPath: /my-npm-react-portlet
-jsp: *.jsp,*.jspf
-plugin.jsp: com.liferay.ant.bnd.jsp.JspAnalyzerPlugin
-plugin.npm: com.liferay.ant.bnd.npm.NpmAnalyzerPlugin
-plugin.resourcebundle: com.liferay.ant.bnd.resource.bundle.ResourceBundleLoaderAnalyzerPlugin
-plugin.sass: com.liferay.ant.bnd.sass.SassAnalyzerPlugin
-sass: *
最后一个pom.xml(代码块不想使用这个)。
<?xml version="1.0"?>
<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/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<groupId>com.liferay</groupId>
<artifactId>my-npm-react-portlet</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.frontend.js.loader.modules.extender</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.util.taglib</artifactId>
<version>2.0.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>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<excludes>
<exclude>**/META-INF/resources/**/.sass-cache/</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.ant.bnd</artifactId>
<version>2.0.41</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.css.builder</artifactId>
<version>2.0.2</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<docrootDirName>src/main/resources</docrootDirName>
</configuration>
</plugin>
</plugins>
</build>
</project>
根据这个问题,我将不胜感激!
答案 0 :(得分:0)
我最近参与了Gradle和Liferay模块。我遇到了类似的未解决的需求问题。我不确定这是否会对您有所帮助或适用于您的问题。
就我而言,我发现bnd.bnd文件需要import语句具有确切的特定格式。我猜它也适用于导出语句。如果不是这种格式,则没有错误,但存在像您这样的部署/运行时问题。
以下用逗号,*和\为我工作,而不是多个import语句。我遇到了埋在Liferay论坛上的这些信息。我不记得帮助我的确切帖子。
Import-Package: \
com.xyz.core.api, \
com.xyz..core.api.model, \
com.liferay.portal.kernel.*, \
*
以下是bnd文档,以防它有用: http://bnd.bndtools.org/chapters/390-wrapping.html 希望这会有所帮助。