When I do this it doesn't compile when I run build.xml and deploy,
I want to do this as it looks much nicer than a huge method call with JournalArticleLocalServiceUtil.addArticle.
JournalArticle journalArticle = new JournalArticleImpl();
journalArticle.setDescription(description);
Does anyone know if it is possible in Liferay 6?
Edit: This is the output I get:
Buildfile: C:\opt\liferay-six1-dev\code\portlets\migration-portlet\build.xml
compile:
merge:
compile-java:
[javac] Compiling 1 source file to C:\opt\liferay-six1-dev\code\portlets\migration-portlet\docroot\WEB-INF\classes
[javac] C:\opt\liferay-six1-dev\code\portlets\migration-portlet\docroot\WEB-INF\src\com\liferay\migration\importdata\JournalArticleImport.java:138: cannot find symbol
[javac] symbol : class JournalArticle
[javac] location: class com.liferay.migration.importdata.JournalArticleImport
[javac] private JournalArticle createJournalArticle(ExportedJournalArticle article) {
[javac] ^
[javac] C:\opt\liferay-six1-dev\code\portlets\migration-portlet\docroot\WEB-INF\src\com\liferay\migration\importdata\JournalArticleImport.java:142: cannot find symbol
[javac] symbol : class JournalArticle
[javac] location: class com.liferay.migration.importdata.JournalArticleImport
[javac] JournalArticle journalArticle = new JournalArticleImpl();
[javac] ^
[javac] C:\opt\liferay-six1-dev\code\portlets\migration-portlet\docroot\WEB-INF\src\com\liferay\migration\importdata\JournalArticleImport.java:142: cannot find symbol
[javac] symbol : class JournalArticleImpl
[javac] location: class com.liferay.migration.importdata.JournalArticleImport
[javac] JournalArticle journalArticle = new JournalArticleImpl();
[javac] ^
[javac] 3 errors
BUILD FAILED
C:\opt\liferay-six1-dev\code\build-common-plugin.xml:403: The following error occurred while executing this line:
C:\opt\liferay-six1-dev\code\build-common.xml:94: Compile failed; see the compiler error output for details.
Total time: 1 second
Okay, now that we've got the compiler failure, it looks like you just haven't got the right libraries on the classpath.
Also, it looks like you're creating your own classes under the com.liferay package - you shouldn't be doing that unless you're building code for Liferay. If you're only building code which uses Liferay, you should be building it under your own organizational package.