mavenize eclipse wtp project (Dynamic web module)

2019-08-28 08:54发布

问题:

Managed to publish my project in Openshift - by scp'ing the war to the correct location as detailed here. Here is the .project file:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>DataCollectionServlet</name>
    <comment></comment>
    <projects></projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments></arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments></arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments></arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments></arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>

Runs locally on glassfish and Jboss - in OpenShift I only have the jbossas gear

Now I want to properly set it up so it is build when I do a git push. Do I need to mavenize the project ? I installed the m2e plugin but "Convert to maven project" did not transfer the dependencies (there are project dependencies and custom jar ones as well as logback and co) and did not create a "maven" folder structure.

Do I have to create a particular folder structure ? Do I need to set up build hooks manually ?

Eclipse Luna, Java EE pack

回答1:

OpenShift uses the pom.xml file to compile and publish your java project. You should try creating a java project on OpenShift, and git clone it locally, then read through the pom.xml file and see what components that you need for it to work. It would be worth doing that and then converting your project into that maven structure that OpenShift uses. It is important to have/leave the openshift profile at the end of the pom.xml as that is what tells your gear where to put your .war file after it is built.