when compile, cannot found the file in jar

96 views
Skip to first unread message

tong123123

unread,
Sep 4, 2012, 11:48:50 PM9/4/12
to google-we...@googlegroups.com
I have a GWT app and I packed it into a jar using maven-source-plugin.
<plugin>         
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>jar-no-fork</goal>
            </goals>
        </execution>       
    </executions>         
</plugin>


the output of the jar contain all the java source file. (part of it is shown in the attached figure "sourceJarContent.jpg)

Then I new another gwt project in eclipse (the project name is als-admin-viewer-webapp-forTesting) and reference this jar (als-admin-viewer-webapp-portlet-1.0.0-source.jar) by using
<dependency>        
     <groupId>hk.gov.ehr.service.tch.als</groupId>
     <artifactId>als-admin-viewer-webapp</artifactId>
     <version>1.0.0</version>
     <classifier>sources</classifier>                      
 </dependency>

as shown in sourcJarContent.jpg, the jar contain a file AdvSearchLogsPanel.java, and in eclipse project als-admin-viewer-webapp-forTesting I can successfully import this java file and use it without red underline in the eclipse editior, but when I run maven compile, the following error is shown:

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 5 source files to D:\workspace\als-admin-viewer-webapp-forTesting\target\www\WEB-INF\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[5,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[6,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[7,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[8,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[9,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[10,53] package hk.gov.ehr.service.tch.als.admin.viewer.shared does not exist

maven cannot see the package hk.gov.ehr.service.tch.als.admin.viewer.client!!
I suspect this is due to setting in AlsAdminViewerWebAppForTesting.gwt.xml, and I try to add the following
<!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>
 
  <source path='../viewer/client'/>
  <source path='../viewer/shared'/>

but the error still exist when compile.
the AlsAdminViewerWebAppForTesting.gwt.xml location is attached in gwt_xml_location.jpg, I use
../viewer/client
because the AdvSearchLogsPanel.java is in als-admin-viewer-webapp-portlet-1.0.0-sources.jar under package hk.gov.ehr.service.tch.als.admin.viewer.client and the AlsAdminViewerWebAppForTesting.gwt.xml is under hk.gov.ehr.service.tch.als.admin.viewerfortesting, is the part
../viewer/client is wrong?
How to successfully compile the java file in the source.jar?

thanks in advance


gwt_xml_location.jpg
sourceJarContent.jpg
Message has been deleted

tong123123

unread,
Sep 5, 2012, 3:23:16 AM9/5/12
to google-we...@googlegroups.com
I even try to add
<source path='hk.gov.ehr.service.tch.
als.admin.viewer.client'/>
but the same error still prompted when compile, so how to compile the java source (java file) in a dependency jar?
is <inherits> in *.gwt.xml related?

tong123123

unread,
Sep 5, 2012, 4:56:21 AM9/5/12
to google-we...@googlegroups.com
my origin GWT module AlsAdminViewerWebApp.gwt.xml has
<module rename-to='alsadminviewerwebapp'>
under package hk.gov.ehr.service.tch.als.admin.viewer

I try to add
<inherits name='hk.gov.ehr.service.tch.als.admin.viewer.alsadminviewerwebapp'/>
or
<inherits name='hk.gov.ehr.service.tch.als.admin.viewer.AlsAdminViewerWebApp'/>
in AlsAdminViewerWebAppForTesting.gwt.xml
but the same error occor!!
package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist.

Thomas Broyer

unread,
Sep 5, 2012, 8:41:57 AM9/5/12
to google-we...@googlegroups.com


On Wednesday, September 5, 2012 5:48:50 AM UTC+2, tong123123 wrote:


[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 5 source files to D:\workspace\als-admin-viewer-webapp-forTesting\target\www\WEB-INF\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[5,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[6,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[7,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[8,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[9,53] package hk.gov.ehr.service.tch.als.admin.viewer.client does not exist
[ERROR] \workspace\als-admin-viewer-webapp-forTesting\src\main\java\hk\gov\ehr\service\tch\als\admin\viewerfortesting\client\AlsAdminViewerWebAppForTesting.java:[10,53] package hk.gov.ehr.service.tch.als.admin.viewer.shared does not exist


This error comes from the maven-compiler-plugin, nothing to do with GWT. You should depend on both the "normal" jar and the source-jar:
 <dependency>         
     <groupId>hk.gov.ehr.service.tch.als</groupId>
     <artifactId>als-admin-viewer-webapp</artifactId>
     <version>1.0.0</version> 
 </dependency>

tong123123

unread,
Sep 5, 2012, 10:41:46 AM9/5/12
to google-we...@googlegroups.com
thanks for the reply.
I am at home now and cannot test the solution. But I try to google this afternoon and see the following links
http://www.vogella.com/articles/GWTModules/article.html
http://nicozan.wordpress.com/2011/03/17/gwt-adding-jar-dependency-to-our-gwt-project-maven-gwt-plugin/
they need use the following statement in *.gwt.xml respectively
<inherits name='de.vogella.gwt.module.model'/>
<inherits name='com.wordpress.nicozan.Model'/>

is this required for my case? (although
I try to add
<inherits name='hk.gov.ehr.service.tch.als.admin.viewer.alsadminviewerwebapp'/>
or
<inherits name='hk.gov.ehr.service.tch.
als.admin.viewer.AlsAdminViewerWebApp'/>
as mention above and still fail.

in fact, under what condition should I use
<inherits .../> in *.gwt.xml?

thanks in advance

tong123123

unread,
Sep 6, 2012, 5:28:19 AM9/6/12
to google-we...@googlegroups.com
I answer myseslf, hope could benefit to others with similar problem.

<inherits name='hk.gov.ehr.service.tch.
als.admin.viewer.AlsAdminViewerWebApp'/>
is needed.
Otherwise, cannot compile.

And, if the dependent gwt app. has entry-point class defined in *.gwt.xml, it will run, that is, two entry-point class will be run, one is your own gwt application, the other is the dependency gwt application entry-point class.
In my case, I comment the
<entry-point>
in the *.gwt.xml of my dependent gwt application.

Reply all
Reply to author
Forward
0 new messages