Alfresco SDK 4.0 build issue on Open JDK 11

cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilesh_s1vak
Active Member II

Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

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 Solution

Accepted Solutions
andrealigios
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

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 solution in original post

24 Replies
EddieMay
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Hi @nikhilesh_s1vak 

Can I just check which version of Alfresco you are using - is it 6.0 (as tagged) or 6.2 (as mentioned in your dev environment description)?

Thanks,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
nikhilesh_s1vak
Active Member II

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Thanks EddieMay for the response. It is 6.2 enterprise. 

 

andrealigios
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Hello @nikhilesh_s1vak ,

I think you might have been fooled by your IDE,
as described here: https://stackoverflow.com/a/55572922/1654265

I would try:

  • running it from the CLI
  • then fixing Eclipse with the ModulePath/ClassPath workarounds described in the answer above
  • eventually, running it from another IDE like IntelliJ CE, probably more JPMS-friendly

Hope that helps

nikhilesh_s1vak
Active Member II

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Hello @andrealigios, Thanks for the response. I have referred the above link and tried to run it from CLI also but the build fails throwing the compilation errors. 

I resolved the similar issue with 3rd party Jars (example: xml api) but this happens with  alfresco.reposiotry and alfresco.data.model.api jars. 

andrealigios
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

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

nikhilesh_s1vak
Active Member II

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Hi @andrealigios,

I have tried the below steps but faced issues while executing them. 

Command: java -version > output.txt

  • Java version is not captured in the ouptu.txt

Command: mvn clean install -Penterprise-62-tests >> output.txt

  • This command doesn't capture anything to output.txt file

Command: mvn archetype:generate -DarchetypeCatalog=local >> output.txt

  • This command never excutes and nothing shows up in the CLI (waits indefinitely) 

      I have removed the file output from the above command and executed only the below part 

Command: mvn archetype:generate -DarchetypeCatalog=local

  • This is not taking any input and asking the same question again as below:
  • Choose archetype:
    Your filter doesn't match any archetype (hint: enter to return to initial list)
    Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): :

Please guide me where i am going wrong. 

andrealigios
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Which OS are you on? Which CLI are you using?

What does it mean that it doesn't capture the ouptut in the output.txt file? That you see the output but the file remains empty, that the file is not even created, or that you don't even see the output of those commands?
Do you have write permission on that folder? On Linux & Mac you can do:

>> ~/output.txt

to create the file in your user's home, where you definitely have write permissions.

Please, ensure you've followed all the steps above (especially the git clone) and then describe more deeply what happens next, thank you.


nikhilesh_s1vak
Active Member II

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution

Hi @andrealigios ,

Which OS are you on? Which CLI are you using?
  • I am on Windows 10 Pro and using Window Command prompt(cmd.exe)

The file(output.txt) is created but the file remains empty. I see output of commands on the console but the file is empty. The only information i could see in the file is the maven version output (mvn -version >> output.txt) . 

The git clone is successful but executing the below mentioned command doesn't show anything on the console.

mvn clean install -Penterprise-62-tests >> output.txt

 So i have removed the output.txt from the above command and executed the command (mvn clean install -Penterprise-62-tests) which gave me 401 unauthorized exception. I fixed that by keeping an entry in the settings.xml and executed the same command again which downloads all the dependencies. 

I have generated the all-in-one archetype as well without writing the resonse to output.txt file. But when i try to write the response to output.txt file, console doesn't show anything and the file remains empty. 

andrealigios
Alfresco Employee

Re: Alfresco SDK 4.0 build issue on Open JDK 11

Jump to solution
  • 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:

Screenshot_2021-02-03 cpa_4 png (WEBP Image, 388 × 565 pixels).png

  • If it doesn't work, can you try:
    dir > test.txt
    and see if it works?

  • If it still doesn't work, can you please try running it from Powershell?

  • 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?

About the repository in the settings.xml you're right, for the Enterprise version it is needed.
I'll ensure we'll document it better if it's not already so.