Eclipse Package maven Project Pit

Source: Internet
Author: User

first, the question:

The company has developed a project that needs to run as a background service, and the whole project is composed of: "Maven + Spring + Eclipse"

There are a number of problems when using packaging:

(1) Integration of MAVEN tools in Eclipse " configuration Warehouse "

(2) The packaged JRE environment must be the JDK itself, the "Performence--java" configuration of the Java Operating Environment "will report a number of environmental exceptions"

(3) The MAVEN Project Package command can use the "Install/maven build" install to hit the installation package into the repository, and build will reach the "target"

(4) "Spring-applicationcontext" If you are using spring manual loading, when reading the configuration file will be reported "offending resource"

(5) If Maven relies on other local jar packages in addition to the warehouse itself, Xi ' an "install" local jar package needs to be packaged in the local warehouse to be able to enter

second, the settlement:

(1) Manual loading of the spring container does not get the configuration file, "Classpath + *"

     Public Static void init () {        ifnull) {            //ac = new Classpathxmlapplicationcontext (" Classpath:spring/applicationcontext-dao.xml ");//Modify to add * number to            new Classpathxmlapplicationcontext ("Classpath*:applicationcontext-dao.xml");             New Classpathresource ("/properties/file.properties");        }    }

  

Three, Summary:

(1) Why add "*" number can identify the problem of classpath, online information said asterisking can identify other jar package project configuration file, no in-depth understanding, we have to know the trouble to comment under

The difference between classpath and classpaht*, classpath* will find all the files in the root directory, until a matching file can be found. Child classpath will only be found in the/web-inf/classes.

(2) When the service debugging, think of a problem, after "cmd" Start a jar package, the console can then see the debug output of the program, open the console again how to view the output of this program?

I tried the jobs command for Linux, but when the console that was running was shut down, the job was closed and could not be re-exported to this console

(3) There is also a spring container loading configuration file error solution is:

<plugin>                  <groupId>Org.apache.maven.plugins</groupId>                  <Artifactid>Maven-shade-plugin</Artifactid>                  <executions>                      <Execution>                          <Phase>Package</Phase>                          <Goals>                              <goal>Shade</goal>                          </Goals>                          <Configuration>                              <Finalname>Dwbi-excel</Finalname>                              <shadedartifactattached>True</shadedartifactattached>                              <Shadedclassifiername>Jar-with-dependencies</Shadedclassifiername>  
<!--Here's another way to fix a configuration file that can't be loaded, I'm not experimenting, it's a colleague test--<Transformers> <TransformerImplementation= "Org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <MainClass>${mainclass}</MainClass> </Transformer> <TransformerImplementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer"> <Resource>Meta-inf/spring.handlers</Resource> </Transformer> <TransformerImplementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer"> <Resource>Meta-inf/spring.schemas</Resource> </Transformer> <TransformerImplementation= "Org.apache.maven.plugins.shade.resource.AppendingTransformer"> <Resource>Meta-inf/spring.tooling</Resource> </Transformer> </Transformers> <Filters> <Filter> <Artifact>*:*</Artifact> <excludes> <Exclude>meta-inf/*. SF</Exclude> <Exclude>meta-inf/*. Dsa</Exclude> <Exclude>meta-inf/*. Rsa</Exclude> </excludes> </Filter> </Filters> </Configuration> </Execution> </executions> </plugin>

      

Eclipse Package maven Project Pit

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.