Using Angular 2 CLI project with JavaEE server

This topic contains 5 replies, has 4 voices, and was last updated by  support-swapna 1 year, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #503092 Reply

    cnikh
    Participant

    I want to make a war file to deploy the Angular2 project which is developed using Angular IDE by Webclipse.
    How to figure this out?

    #503312 Reply

    support-piotr
    Participant

    Hi Cnikh!

    Thanks for giving a try to Angular IDE! Good news is that we do have integrated support for JavaEE on our roadmap. However, even now, it’s just few steps to get your project deployable to Tomcat.

    First install required facets to the project:

    1. Right click on the project in Project Explorer+ and choose “Properties” and than choose “Project Facets”
    2. From the facet list choose Java and Dynamic Web Module (any 3.x)
    3. Click “Further configuration available…” link below the list of facets
    4. On the “Java” page, select “src” folder and remove it (unless you want to make a hybrid project, though in this case setup is slightly more complicated) and click Next
    5. On the “Web Module”, change “Content directory:” to dist (dist is the default output folder for ng build. If you changed the default setting, enter appropriate name here) and press OK.
    6. Press OK to install facets.

    Now, build the project and deploy to your server:

    1. Open Terminal+ View and select your project from the combo list of from Project Explorer+
    2. Type command ng build --watch to build the project. This should populate dist folder with contents. --watch flag will keep the command running and rebuilding dist contents always when a change is made to the source code. You should always ensure this command is running in the terminal before starting the server.
    3. You can now deploy your project to Tomcat or other JavaEE servers.

    Let me know if this works for you!

    P.S. If you have troubles running ng build, please run command
    npm install --save-dev angular-ide@0.9.8.

    #504312 Reply

    cnikh
    Participant

    Thanks for your prompt response. Its working.

    #504314 Reply

    support-piotr
    Participant

    Hi Cnikh!

    I am glad it works for you! Please let us know if you have any problems or suggestions for Angular IDE!

    Best regards,
    Piotr Tomiak

    #522509 Reply

    Yang Fan
    Participant

    Hi,Piotr Tomiak,
    I did exactly as you said above,but after deployed to tomcat ,I’m not sure how to access my app.
    After I entered my url in browser “http://localhost:8080/MyProjectName”,it brougnt me to my index.html, but the error were “Failed to load http://localhost:8080/vendor.bundle.js” and all the other js, Could you help me find the problems? Thanks!

    Yangfan

    ——————————————————

    Sorry to bother you ,I have solved this problem by changing the <base href=”<%=basePath%>”>, then it can find my js!

    • This reply was modified 1 year, 3 months ago by  Yang Fan.
    Attachments:
    You must be logged in to view attached files.
    #522738 Reply

    support-swapna
    Moderator

    Yangfan,

    Glad that you figured it out.
    Please let us know if you see any other issues.

    –Swapna
    MyEclipse Support

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Using Angular 2 CLI project with JavaEE server