MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
trant
Post subject: Having problems with the source files  PostPosted: May 10, 2011 - 07:28 PM
Registered Member
Registered Member


Joined: Mar 14, 2007
Posts: 39

I had this working yesterday, and now today it is suddenly not finding my source files and property files. So when I run "package" to build my war file and then I open the war to inspect it I find that the classes folder is completely empty - it does not have any of my application class files. Nor do any of the property files appear.

I believe the problem stems from MyEclipse itself, in that it is not copying or building my source files into the target\classes folder that maven operates from.

Yet yesterday it was doing this just fine.

My project is setup pretty much as default, I have a \src directory where my java files are under their package folders (i.e. \src\com\test\MyClass.java) and then I have a \web directory which is my root web app directory for WEB-INF and the web files.

Finally there is the \target folder which is maven's staging directory

All I used to do is right click my pom.xml, choose Run As and maven package.

Yesterday it was getting all my class files and building my war just fine, and I even did some manual tests via web browser that would not have been possible had the web app not had any class files in it.

So what could be wrong now?

I did check my project's build path- under "Source folders for build path" I have MyApp/src listed as a source folder.

Under "Default output folder" it shows MyApp/target/classes

everything looks correct here

My pom.xml looks like this:


Code:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>MyApp</artifactId>
  <version>0.0.1</version>
  <packaging>war</packaging>
  <name>My App</name>   
  <profiles>
    <profile>   
      <id>dev</id>
      <activation>
        <activeByDefault/>
      </activation>
      <properties>
        <env>dev</env>
        <weblogic.host.name>localhost</weblogic.host.name>
        <weblogic.port>7001</weblogic.port>
        <weblogic.protocol>t3</weblogic.protocol>
        <weblogic.user>weblogic</weblogic.user>
        <weblogic.password>weblogic</weblogic.password>
        <weblogic.target>AdminServer</weblogic.target>       
      </properties>
    </profile>
  </profiles>
  <dependencies>
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.0.5.RELEASE</version>
     </dependency>
     <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>3.0.5.RELEASE</version>
    </dependency>
  </dependencies>
  <build>
     <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <configuration>
            <warSourceDirectory>web</warSourceDirectory>            
          </configuration>
        </plugin>
        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>weblogic-maven-plugin</artifactId>
        <version>2.9.1</version>           
        <configuration>
          <adminServerHostName>${weblogic.host.name}</adminServerHostName>
          <adminServerPort>${weblogic.port}</adminServerPort>
          <adminServerProtocol>${weblogic.protocol}</adminServerProtocol>
          <userId>${weblogic.user}</userId>
          <password>${weblogic.password}</password>
          <verbose>false</verbose>
          <debug>true</debug>
          <targetNames>${weblogic.target}</targetNames>
        </configuration>
        <dependencies>
          <dependency>
               <groupId>weblogic</groupId>
               <artifactId>fullclient</artifactId>
               <version>10.3</version>
             </dependency>
        </dependencies>
        <executions>
               <execution>
                  <phase>install</phase>
                  <goals>
                    <goal>deploy</goal>
                  </goals>
               </execution>
            </executions>
      </plugin>
      </plugins> 
   </build>
</project>
 
 View user's profile Send private message  
Reply with quote Back to top
trant
Post subject:   PostPosted: May 10, 2011 - 07:48 PM
Registered Member
Registered Member


Joined: Mar 14, 2007
Posts: 39

Have an update on this problem:

I updated a java file, and then I noticed MyEclipse displayed an error on that file when I clicked Save. It said a class I was importing does not exist- but this class is part of my application in another package, and it is clearly imported. Then I went to that class, made a change just so I can trigger a Save on it too, and then that error went away. So it seems like none of my java files were compiled anyplace.

Is this because I ran a maven clean command, which deleted all my class files in the target\classes folder?

if so, then what is the way I should do this? Never run clean? Or do I need to somehow customize my setup so that MyEclipse has a separate folder it can dump classes to which maven then pulls from, or modify my pom.xml so that maven compiles the files from my src directory? Not sure what is the best practice here.... I was expecting MyEclipse with Maven capabilities would work out of the box?

[EDIT] Another update:

I restructured my source directories to a more Maven-like structure:

src\main\java where my main app source is
src\main\test where my test source is

now maven works just as expected, it finds the source files. It also locates my test files now and executes them automatically - great.

However one slight problem - why are my test classes being included in my WAR file?

Shouldn't they be excluded by default?

How can I make them excluded?
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject:   PostPosted: May 11, 2011 - 05:31 AM



Joined: Nov 11, 2010
Posts: 2153

trant,

I escalated this to the dev team. They will get back to you.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
support-tomasz
Post subject:   PostPosted: May 12, 2011 - 02:27 PM



Joined: Apr 14, 2011
Posts: 22

To exclude the test class files You can try to use exclude configuration for maven-war-plugin or You can clean the project and use -Dmaven.test.skip=true then Your test classes will not be compiled and included in the war file. If You are able to reproduce this error with missing class files, please send us the error log.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits