facebook

Web deployment with a Maven project

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #694243 Reply

    steveh
    Participant

    I’ve been trying to deploy a Maven web project to the internal Tomcat 9.0 but it doesn’t seem to be working as I expected.

    If prior to deployment I go to Deployment Assembly, then Add -> Java Build Path Entries -> Maven Dependencies -> Finish then the project won’t appear in the Add/Remove Deployments dialog. If I deploy it first without dependencies, then go to Deployment Assembly to add Maven dependencies and then for the server choose Publish I get an error with the following in the log:

    java.lang.NullPointerException: Cannot invoke “org.eclipse.wst.common.componentcore.resources.IVirtualComponent.getDeployedName()” because “component” is null
    at org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities.getDefaultProjectArchiveName(VirtualReferenceUtilities.java:81)
    at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getJavaClasspathReferences(J2EEModuleVirtualComponent.java:358)
    at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getNonManifestRefs(J2EEModuleVirtualComponent.java:262)
    at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:181)
    at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.addConsumedReferences(FlatVirtualComponent.java:259)
    at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.treeWalk(FlatVirtualComponent.java:234)
    at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.cacheResources(FlatVirtualComponent.java:188)
    at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.fetchResources(FlatVirtualComponent.java:118)

    For now I’ve worked around it by manually getting Maven to copy dependencies and then deploying the target/dependency folder but it would save hassle not having to go through this stage each time a change is made to a related project.

    This is with MyEclipse 2022.1.0 running on Windows 10.

    #694255 Reply

    Brian Fernandes
    Moderator

    Steve,

    I presume this is a project with the maven-war-plugin? If so, you should import the project into Eclipse using the Maven import wizard – this will run a few additional steps which will analyze the pom.xml and create the corresponding Eclipse metadata for the tooling within MyEclipse. For instance, since your project has the Maven war plugin, the web facet will be added and deployment assembly will be correctly set up, automatically.

    You could try to undo the Eclipse level changes you’ve manually made and re-import the project from its raw Maven from using File > Import > Maven > Existing Maven Projects.

    Hope this helps!

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Web deployment with a Maven project

You must be logged in to post in the forum log in