facebook

maven web project does not copy non-java files to classes

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #292025 Reply

    akmalhussain
    Member

    Hi
    I imported a maven project in ME7 full release and deployed it to the sandbox tomcat 6. It deploys all the files except the properties files in src/main/resources. These files would normaly be copied to the web-app’s classes folder but only the java classes are there. The .classpath file is correct, it specifies the paths correctly. The project works fine outside of ME 7, on a seperate Eclipse ganymede install with the maven plugin. I’ve tried deploying to non-sandbox tomcat 5 and 6 but still the same problem.

    Is there anything I am doing wrong?

    Thanks
    Akmal

    The .classpath is:
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <classpath>
    <classpathentry kind=”src” output=”target/classes” path=”src/main/java”/>
    <classpathentry kind=”src” output=”target/classes” path=”src/main/resources”/>
    <classpathentry kind=”src” output=”target/test-classes” path=”src/test/java”/>
    <classpathentry kind=”src” output=”target/test-classes” path=”src/test/resources”/>
    <classpathentry kind=”con” path=”org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5″>
    <accessrules>
    <accessrule kind=”accessible” pattern=”*/**”/>
    </accessrules>
    </classpathentry>
    <classpathentry kind=”con” path=”org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER”>
    <attributes>
    <attribute name=”org.eclipse.jst.component.dependency” value=”/WEB-INF/lib”/>
    </attributes>
    </classpathentry>
    <classpathentry kind=”output” path=”target/classes”/>
    </classpath>

    #292051 Reply

    Loyal Water
    Member

    If you add the properties file to the root of your /src directory, does it go into the /class folder ?

    #292092 Reply

    akmalhussain
    Member

    Hi, the java compilation part is fine. The properties files along with the class files are correctly placed in the target/classes folder. The problem is when doing the web deployment as an exploded web app. – no properties files are deployed.

    I have since tried deleting the eclispe/myeclipse metadata files and re-importing the maven project. This time the .classpath created was different and it worked (except for the test paths which I changed manually):

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <classpath>
    <classpathentry kind=”src” output=”src/main/webapp/WEB-INF/classes” path=”src/main/java”/>
    <classpathentry kind=”src” output=”src/main/webapp/WEB-INF/classes” path=”src/main/resources”/>
    <classpathentry kind=”src” output=”src/main/webapp/WEB-INF/classes” path=”src/test/java”/>
    <classpathentry kind=”src” output=”src/main/webapp/WEB-INF/classes” path=”src/test/resources”/>
    <classpathentry kind=”con” path=”org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5″>
    </classpathentry>
    <classpathentry kind=”con” path=”org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER”/>
    <classpathentry kind=”output” path=”src/main/webapp/WEB-INF/classes”/>
    </classpath>

    The problem is that the above configuration is not consistent with the general maven paths of using the target folder for output and the test output is not pointing to the correct location.

    Other than this minor issue, ME7 is a really great product. Thanks.

    #292180 Reply

    allenparslow
    Member

    I’m observing the same behavior in MyEclipse 7.0GA, there is a potential workaround for the time being:
    Go to the project’s java build path, from “/src/main/resources/” and click on “Excluded: **”, then press the “remove” button.

    NOTE:
    If using the maven wizard (which only uses a /src/) it does copy resources into /WEB-INF/classes/ and mvn install does build war with resources. However, /src/ is not the maven standard (it’s /src/main/java/, /src/main/resources/, and /src/test/java/) and I think if you surveyed existing maven users, you would find that most would NOT want to move back to a single source folder.

    #292439 Reply

    akmalhussain
    Member

    Ok, some further information. Do a maven import and let eclipse create the .classpath file with the paths pointing to …/webapp/WEB-INF/… . Then right-click the project and select the Update Project Configuration option from the Maven4MyEclipse menu option. This wil refresh the project settings and update the .classpath with the correct path pointing to the target structure. Then, deploying the non-java resources also works correctly.

    #300501 Reply

    bimki
    Member

    for me files from /src/resources directory are still not copied when myeclipse deploys project to Tomcat server.

    when I run “mvn install” on my project, I can see that all resources are on the right place in generated .war file.
    But deploying/publishing project to server doesn’t copy resources…

    Du You have an issue or I’m doing something wrong?

    #300526 Reply

    akmalhussain
    Member

    Edit your .classpath and ensure there are no exclude attributes. For what ever reason, the maven plugin sometimes puts exclude filters for the non-java classpathentry elements. You can also do this from the project properties->java build path->source tag.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: maven web project does not copy non-java files to classes

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