cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco SDK 4.0 build issue on Open JDK 11

nikhilesh_s1vak
Confirmed Champ
Confirmed Champ

I have been trying to set up the development environment in Alfresco SDK 4.0 with Open JDK 11. I have downloaded the all in one project as mentioned in the documentation and even referred jeff pott's material (https://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html#alfres...).

I have applied enterprise license and able to start and test the application. But when i put my customized code in the project structure i faced lot of compilation issues which i have fixed eventaully. But there are few stubborn issues which are related Java modules are giving me a tough time. 

Below issues are failing the build. 

The package com.xxxx.xxxx.entities is accessible from more than one module: <unnamed>, xxxx.alfresco ( In imports declaration)

The package com.com.xxxx.xxxx.entities conflicts with a package accessible from another module: xxxx.alfresco (In Package declration)

I have understood that this issue is related to JDK modules and fixed it by excluding the unnecessary jar in the pom.xm (for 3rd party jars such as xml and w3c). But the above problems arises when i try to build my customized code. 

Below is my development environment i have used:

  • Alfresco/SDK Version: 6.2 Enterprise/ SDK 4.0
  • Eclipse Version : 4.18
  • Java Version : Open JDK 11.0.1
  • Maven Version : Apache Maven 3.6.3
1 ACCEPTED ANSWER

Hi @nikhilesh_s1vak,
let's take a step back and try as follows (all from the CLI):

  • java -version > output.txt
  • mvn -version >> output.txt
  • git clone https://github.com/Alfresco/alfresco-sdk.git sdk-4.2
    or (if you want to use SSH instead of HTTPS):
    git clone git@github.com:Alfresco/alfresco-sdk.git sdk-4.2
  • cd sdk-4.2
    mvn clean install -Pmaven.test.skip=true
    mvn archetype:generate -Dfilter=org.alfresco:
  • Answer to the questions (eg. "2" - All-In-One Archetype, "15" - SDK 4.2.0, and then proper groupId and artifactId), apply the license properly, etc.
  • Do what's described in the Working with Enterprise guide, hence turn your generated project's pom.xml into:

    <alfresco.bomDependencyArtifactId>acs-packaging</alfresco.bomDependencyArtifactId>
    
    <docker.acs.image>quay.io/alfresco/alfresco-content-repository</docker.acs.image>
    
    <alfresco.platform.version>6.2.2.10</alfresco.platform.version>
    <alfresco.share.version>6.2.2.2</alfresco.share.version> 
    
    <keystore.settings></keystore.settings>
  • Add your custom code, then run it by appending:
    >> output.txt
    at the end of the command.

If the problem is still there at this point, please post here the output.txt file so we can have a look at it.

If instead the problem is gone, then the culprit was likely a dirty cache or the fact that the right version of the SDK to use today is 4.1 or 4.2.

Hope that helps

View answer in original post

24 REPLIES 24

Hi @andrealigios,

Thanks for the swift response. Please find below inline comments for your questitons. 

  1. Can you please try running the Command Prompt as an Administrator?
    To do that, Right Click on the Command Prompt icon, then select Run as administrator:
    • Yes, i ran the command prompt as an administrator
  2. If it doesn't work, can you try:  dir > test.txt and see if it works?
    • It works and the dir info is written to the file.
    • But when i executed the java -version > test.txt, the file remains empty.
  3. If it still doesn't work, can you please try running it from Powershell?
    • Yeah i have tried in powershell but the result is same. image
  4. Apart from creating or not the output.txt file, can you try adding your custom code to this newly created all-in-one SDK-4.1 project, and see if you get the same error as before?
    • Sure i will do it and let you know the result. 

What if you do:

"java -version" > test.txt

?

Unluckily, I've no Windows here and cannot try it myself, but I suspect it's something like that...

The command supposed to be as below:

java -version 2>output.txt

Hi @andrealigios ,

The build was successfull with all in one archetype though i had issues with integration-tests. I have applied the enterprise license and verified the application. 

But when i run after adding the custom code the build fails throwing compilation errors. I am trying to import the project to Eclipse to understand the errors. But i think those issues are mostly the same issues which i was facing earlier. 

But i will update you soon once the import is successful. Kindly let me know how can i upload the output.txt file here?

You can use a service like https://pastebin.com/ , or even paste its content here in a code block, as you prefer.

Hi @andrealigios 

Please find the below pastebin links of the output.txt response.

Before adding the custom code:

After adding the custom code:

Hi @andrealigios ,

Did you get a chance to look into it?

Hi @nikhilesh_s1vak , yes I've had a look at it on Friday but then got very busy with the release of the new Alfresco SDK 4.2, which is almost ready.

Can you please tell me the exact version of Platform/Repo you're using (6.2.x.x)?

In Q4 2020, the Alfresco Platform has undergone a major structural refactoring, and your code might need to be revised in order to work against versions newer than November 2020.

Please provide me with this information, I'll have a look again at your log ASAP.

Hi @andrealigios 

We are using Alfresco enterprise 6.2.0 version. 

I see your custom code is quite big since by default it compiles 128 files:

[INFO] Compiling 128 source files to C:\Nikhilesh\Work\Alfresco\alfresco 6.2\sdk-4.1\alfsdk41\alfsdk41-platform\target\classes


Unless the code is all related to a single functionality, I suggest you (as a golden rule) split it into smaller parts and start adding them one by one, testing when it stops working.

That said, the "Cannot find Symbol" error has several possible causes, but since we're talking about migrating from Java 8 or earlier to Java 9 or higher, which is where JPMS kicked in, you must probably just include a few libraries (and eventually refactor the imports with the help of your IDE, if they're changed) in the pom.xml.

Libraries that were included by default before and are not in the JDK anymore now.

For example, it happened to Java EE, and now if you need "javax" components you need to import them, eg.:

    <artifactId>javax.annotation-api</artifactId>

which in modern Java is not available by default.


While Maven simply complains, your IDE should also help you identify immediately what the problem is.

Please ensure that Eclipse (or IntelliJ CE) is properly configured to compile your project against Java 11 and not other versions, then take a look at all the red flags it should raise. 

At that point, it should really be a matter of identifying where the missing classes are gone in JDK11, and how to bring them back (likely by declaring them explicitly in pom.xml)

Please let me know if it helped.